[DOCS-5135] Document that DBRef objects allow extra fields Created: 31/Mar/15  Updated: 30/Oct/23  Resolved: 08/Apr/22

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Task Priority: Minor - P4
Reporter: Jeremy Mikola Assignee: Ashley Brown
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-12263 Support $elemMatch with DBRefs that m... Closed
is related to DRIVERS-1173 Driver Handling of DBRefs Implementing
Participants:
Days since reply: 1 year, 43 weeks ago
Epic Link: DOCSP-11702
Story Points: 3

 Description   

Concise definition of a DBRef from SERVER-12263:

DBRefs are objects whose first two fields must be $ref and $id (in that order). An optional $db field, if present, must appear third. Other fields may follow (they can't have a $ prefix, of course).

We don't seem to have a real spec for DBRef objects, but the note about optional fields beyond $db is important. Some libraries and ODMs store extra metadata in these fields, and it'd be helpful to document that MongoDB does allow this (both for community developers and our own reference, as the server has broken this validation from time to time).

Scope of Changes

Review and update https://docs.mongodb.com/manual/reference/database-references/ with info on optional fields beyond $db. We should clarify that MongoDB does allow this functionality with DBRefs.



 Comments   
Comment by Githook User [ 13/Apr/22 ]

Author:

{'name': 'Ashley Brown', 'email': '98361885+mdb-ashley@users.noreply.github.com', 'username': 'mdb-ashley'}

Message: DOCS-5135 Add information about extra DBRef fields (#921)

  • Add note about extra DBRef fields
Comment by Githook User [ 08/Apr/22 ]

Author:

{'name': 'Ashley Brown', 'email': '98361885+mdb-ashley@users.noreply.github.com', 'username': 'mdb-ashley'}

Message: DOCS-5135 Add information about extra DBRef fields (#921) (#935)

  • Add note about extra DBRef fields
Comment by Githook User [ 08/Apr/22 ]

Author:

{'name': 'Ashley Brown', 'email': '98361885+mdb-ashley@users.noreply.github.com', 'username': 'mdb-ashley'}

Message: DOCS-5135 Add information about extra DBRef fields (#921) (#934)

  • Add note about extra DBRef fields
Comment by Githook User [ 08/Apr/22 ]

Author:

{'name': 'Ashley Brown', 'email': '98361885+mdb-ashley@users.noreply.github.com', 'username': 'mdb-ashley'}

Message: DOCS-5135 Add information about extra DBRef fields (#921) (#933)

  • Add note about extra DBRef fields
Comment by Githook User [ 08/Apr/22 ]

Author:

{'name': 'Ashley Brown', 'email': '98361885+mdb-ashley@users.noreply.github.com', 'username': 'mdb-ashley'}

Message: DOCS-5135 Add information about extra DBRef fields (#921)

  • Add note about extra DBRef fields
Comment by Ashley Brown [ 06/Apr/22 ]

Hi jmikola, thanks for bringing this to our attention, and sorry about the delay! I've proposed an update to the manual and requested your review in this PR. Thanks!

Comment by Jeremy Mikola [ 15/Jun/21 ]

It's not clear to me why this was originally resolved as "Won't Fix" in 2016 (no comment/justification was given).

We recently wrote a DBRef Specification (DRIVERS-1173), which coincides with MongoDB 5.0 relaxing restrictions on dots/dollars in field names (DRIVERS-1237). Would it be possible to revisit this issue so the MongoDB manual can be revised to align with the specification?

Generated at Thu Feb 08 07:49:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.