MongoDB AND query

As of version 2 MongoDB allows “AND” query (link)

For those of us that don’t yet have version 2; a hack could be used to partially emulate functionality of AND query by sorting on the field.  Note that this may only work in some limited cases; e.g. if you want to $and the $exists field; you can substitute by sorting on it e.g.:  “ratings”:-1

keywords: mongodb mongolab $and

About Neil Rubens

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *