Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-13661

Increase the maximum allowed depth of query objects

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.6.1, 2.7.0
    • Affects Version/s: 2.6.0
    • Component/s: Querying
    • Labels:
      None

      Issue Status as of April 21, 2014

      ISSUE SUMMARY
      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.

      USER IMPACT
      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.

      WORKAROUNDS
      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.

      RESOLUTION
      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.

      AFFECTED VERSIONS
      MongoDB 2.6.0 is affected by this bug.

      PATCHES
      The patch is included in the 2.6.1 production release.

      Original description

      Right now the number of recursive calls is limited to 20 in parsing (which corresponds to a maximum allowed tree depth of 10):

      https://github.com/mongodb/mongo/blob/019c401589b34b46bf7bec801e23bd3dd7796151/src/mongo/db/matcher/expression_parser_tree.cpp#L46

      Some autogenerated queries may hit this limit, so let's make it higher.

            Assignee:
            david.storch@mongodb.com David Storch
            Reporter:
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: