Skip to content

Instantly share code, notes, and snippets.

@scotthernandez
Created May 30, 2010 17:07
Show Gist options
  • Save scotthernandez/419167 to your computer and use it in GitHub Desktop.
Save scotthernandez/419167 to your computer and use it in GitHub Desktop.
> db.oder.save({x:1})
> db.oder.save({x:3})
> db.oder.save({x:2})
> db.oder.find({x:{$in:[1,2,3]}})
{ "_id" : ObjectId("4c029a9ec94d0000000077c5"), "x" : 1 }
{ "_id" : ObjectId("4c029aa0c94d0000000077c6"), "x" : 3 }
{ "_id" : ObjectId("4c029aa2c94d0000000077c7"), "x" : 2 }
> db.oder.ensureIndex({x:1})
> db.oder.find({x:{$in:[1,2,3]}})
{ "_id" : ObjectId("4c029a9ec94d0000000077c5"), "x" : 1 }
{ "_id" : ObjectId("4c029aa2c94d0000000077c7"), "x" : 2 }
{ "_id" : ObjectId("4c029aa0c94d0000000077c6"), "x" : 3 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment