mongodb $in limit [duplicate]

2019-01-28 00:08发布

问题:

This question already has an answer here:

  • What is the maximum number of parameters passed to $in query in MongoDB? 3 answers

Was just wondering if there is a limit to Mongodb's $in function?

http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24in

I have a collection of users (BIG) and have a smaller subset of ObjectIds stashed somewhere, and I want to select all users (collections) that are in my ObjectIds.

Thanks

回答1:

Since there's no limit on the number of items in an array as such, you shouldn't have any problem.. For the case when the array is embedded inside a document, you might want to have a look at these:

http://groups.google.com/group/mongodb-user/browse_thread/thread/4a7caeba972aa998?fwc=1

Filtering content based on words

http://groups.google.com/group/mongodb-user/browse_thread/thread/28ae76e5ad5fcfb5



标签: mongodb