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

Disallow specifying $ref as a top-level query operator

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Query Optimization
    • 0
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      It isn't possible to insert a document with a $ref key at the top-level, so there's no way for the query to ever match anything.

      > db.mycoll.insert({$ref: 'mycoll', $id: 1})
      WriteResult({
        "nInserted" : 0,
        "writeError" : {
          "code" : 2,
          "errmsg" : "Document can't have $ prefixed field names: $ref"
        }
      })
      

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: