$in limit to array ?

749 views
Skip to first unread message

Nicolas

unread,
Oct 11, 2011, 4:37:42 AM10/11/11
to mongodb-user
Hello,

it is there a data limit (_id) not to exceed with $in ?
Do you think a array to 1000 _id is too ?

Otherwise there is a better solution for large array ?

Karl Seguin

unread,
Oct 11, 2011, 5:01:21 AM10/11/11
to mongod...@googlegroups.com
Only the document size limit of 16MB...aside from that, it shouldn't be a problem.

You won't know what kind of actual performance you get without trying it though.

Sam Millman

unread,
Oct 11, 2011, 5:24:17 AM10/11/11
to mongod...@googlegroups.com
what is the structure of this array?

maybe you can do find({ 'in_ids' : ObjectId("44567ggh0001") })?

But so long as there is an index there it should be relatively fine. Best to benchmark tbh.


--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.


Scott Hernandez

unread,
Oct 11, 2011, 8:01:09 AM10/11/11
to mongod...@googlegroups.com
You can use $in with non-array fields, like _id.

On Tue, Oct 11, 2011 at 4:37 AM, Nicolas <kin...@gmail.com> wrote:
> Hello,
>
> it is there a data limit (_id) not to exceed with $in ?
> Do you think a array to 1000 _id is too ?

1000 items should be fine.

> Otherwise there is a better solution for large array ?

Do you have an example? $in is probably the best option but an example
will help with other suggestions.

Sam Millman

unread,
Oct 11, 2011, 8:20:20 AM10/11/11
to mongod...@googlegroups.com
Oops I may have misread lol
Reply all
Reply to author
Forward
0 new messages