[SERVER-24086] Disallow specifying $ref as a top-level query operator Created: 06/May/16  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Max Hirschhorn Assignee: Backlog - Query Optimization
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Query Optimization
Participants:
Linked BF Score: 0

 Description   

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"
  }
})



 Comments   
Comment by Jeremy Mikola [ 05/May/21 ]

It isn't possible to insert a document with a $ref key at the top-level

I don't think this still applies given the work in PM-1856. Should this ticket be revisited for 5.0?

Generated at Thu Feb 08 04:05:20 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.