Querying on $keyname is possible and leads to collection scans

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      A query can be created to scan for a non existent key that starts with a $.

      These fields are not permitted to be inserted, but can still be queried on. This leads to a collection scan, which can have many performance impacts.

      If the $ character denotes an operator (like $inc, $date etc) then when some unknown operator is found, it should be rejected by the query rather than cause a collection scan. In this way queries like

      db.test.find({$keyname:1})
      

      would fail.

            Assignee:
            Unassigned
            Reporter:
            Andre de Frere
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: