Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-5135

Document that DBRef objects allow extra fields

      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.

            Assignee:
            ashley.brown@mongodb.com Ashley Brown
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              2 years, 15 weeks, 2 days ago