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

Querying on $keyname is possible and leads to collection scans

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Querying
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            andre.defrere@mongodb.com Andre de Frere
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: