The limit for the recursive tree depth of query documents currently is only 10 levels deep. While most queries should not be affected by this issue, certain auto-generated queries, for example from ORM mappers, can construct complex nested query documents and hit the limit.
In 2.4 the limit was not strictly enforced, so users may find some of their queries to be rejected after upgrading to 2.6.
Manual queries with a high tree depth often can be reduced to a flatter version, for example by removing nested $and predicates and instead adding the conditions to a single $and statement.
This patch increases the tree depth from 10 to 100 and brings it in line with the value documented on the MongoDB Limits and Thresholds page.
MongoDB 2.6.0 is affected by this bug.
The patch is included in the 2.6.1 production release.
Right now the number of recursive calls is limited to 20 in parsing (which corresponds to a maximum allowed tree depth of 10):
Some autogenerated queries may hit this limit, so let's make it higher.
- related to
SERVER-15559 Fatal Exception: Deeply nested $cond drops mongod process