Giving the user the ability to create queries with arbitrary many filter conditions

Supposed that a collection has billions of documents. Can mongodb handle queries that have hundreds of filter conditions on this collection? Assuming that this collection is indexed properly?

The document limit and max nesting depth is fine. They will not be exceeded. The reason for queries having so many conditions is because the user is free to combine or statements with and statements arbitrarily. So even if a document only contain 50 fields, the number of filter conditions can balloon easily to hundreds.

@Big_Cat_Public_Safety_Act ,

I don’t see a problem with that as long as the filter document itself does not cross 16mb itself :rofl:

Would queries having hundreds of filter conditions exceed the 16mb limit?

Well that depands on the filter nature :wink:

If you have a $in with 1m objects for example?

So its a hard question to answer, test your application…