Finding multiple words with find() in MongoDB

According to Mongo docs the currect way to this is the folllowing

var words = [/hello/, /^world/];// array of regex
db.getCollection('word collection').find({"word" : {$in : words}});

To accomplish this in JS you can create an array of RegEXp Objects and pass that array as the value of $in some thing like this :

words = words.map(function(v){return new RegExp(v)});

Sorry for late answer, just googled your question. You should use one regex, not an array of them, like:

'^[work|accus*|planet]'

You can't use $regex inside an $in expression, but you can use JS regex (the "/regex/" kind).

From the MongoDB docs at http://docs.mongodb.org/v2.2/reference/operator/query/regex/#in-expressions:

To include a regular expression in an $in query expression, you can only use JavaScript regular expression objects (i.e. /pattern/ ). You cannot use $regex operator expressions inside an $in.

BTW, I know it's a very late answer, but hopefully it'll serve the queriers of the future...