lessons learned using mongodb

Back in 2012, there was a new way to build web apps fast and packed full of features. It was MEAN. MongoDB, Express, Angular, and Node. I built a number of apps with this technology, and it worked. However, as time passed they began to show their weaknesses. Today we’ll look at a few lessons learned from MongoDB. What MongoDB Kicks Butt At Most technologies cannot be just dismissed outright, even though you read article after article telling you “Why you should not X”.

The MEAN Stack

Maybe you’re familiar with the LAMP stack? Linux, Apache, MySql, PHP. That’s been a pretty common way to serve websites for many years (circa 1998?). But things have changed, technologies have changed, and it’s not 1998 anymore. IE6 is dead, nested tables are dead, and the LAMP stack is the Old and Busted. The New Hotness is the MEAN stack, MongoDB, ExpressJS, AngularJS, and NodeJS. This new stack of technologies is what many new web apps are using these days.

MongoDB "Couldn't Send Query"

I would get random error messages from my MongoDB based app GoScouter of couldn’t send query It was random and quite frustration. I was not able to find anything definite online about such error, but that it might be a bug in the PHP MongoDB Driver. I was using version 1.2.7, so I did a pecl upgrade mongo on the web server (using PHP-FPM) and this seemed to fix the problem.

Performing a 'like' match in MongoDB

So looking through the Doctrine ODM docs on Query Building, I didn’t see anything that lent itself to a like query such as that is found in MySQL. There isn’t a like, option, but using Regular Expressions will work just fine for me. $queryBuilder-field('title')-equals(new \MongoRegex('/keyword/i')); That will perform a case-insensative query for the term ‘keyword’ in the field ‘title‘ Resources http://groups.google.com/group/doctrine-user/browse_thread/thread/daadb4e3030c196c