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

Document that DBRef objects allow extra fields

    XMLWordPrintableJSON

Details

    • Task
    • Status: Closed
    • Minor - P4
    • Resolution: Fixed
    • None
    • None
    • manual, Server
    • None

    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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved:
                1 year, 7 weeks, 4 days ago