Disallow specifying $ref as a top-level query operator

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • None
    • Query Optimization
    • 0
    • None
    • 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:
            [DO NOT USE] Backlog - Query Optimization
            Reporter:
            Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: