Most developers are coming from a background with relational database-specific experience, and then trying out some new NoSQL databases like MongoDB. Here are some “gotchas” I ran into while using MongoDB with my MySQL hat still on:
Queries are case-sensitive
Fields and queries in MongoDB are case-sensitive:
1
2
3
var test1 = db.test.find({’tags’: ‘jquery’}).count();
var test2 = db.test.find({’tags’: ‘jQuery’}).count();
test1 == test2; [...]
I’ve spent the past few weeks here at work researching and playing with NoSQL databases (and especially MongoDB) for a new feature we’re developing that doesn’t easily fit into a relational model. And so far, I really like what I see. The profoundness of the shift away from the relational model and the implications that [...]
March 24, 2010 | Posted In
Database,
MySQL by Vance Lucas
Comments Off
Multi-byte characters can cause quite a few headaches for the unsuspecting webmaster. Sometimes all you need to do to figure out how to fix the problem is detect which database records have UTF-8 data in them and which ones do not. If you’ve been scanning records manually, stop now. Here’s a quick query to cure [...]
December 16, 2009 | Posted In
Database,
MySQL by Vance Lucas
Comments Off
Sometimes there are unique situations where you need to order query results by a particular field in descending order, but also need NULL values first. The default (and logical) behavior of MySQL in this case is to return NULL values last, because in descending order they have the lowest value (none). But what if you [...]