Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9790

DBRef string representation should include $db

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 2.7.2
    • Affects Version/s: None
    • Component/s: Shell

      The string representation of DBRef only shows the $ref and $id but not the $db. This could lead to confusion if the DBRef references a different database.

      > db.halloa.find({"name" : "dukur"})
      { "_id" : ObjectId("519e5c065ef254863b9051c6"), "name" : "dukur", "myref" : DBRef("people", "5191cc6684ae75ea07e4ef3b") }
      > z=db.halloa.find({"name" : "dukur"}).toArray()[0]
      {
          "_id" : ObjectId("519e5c065ef254863b9051c6"),
          "name" : "dukur",
          "myref" : DBRef("people", "5191cc6684ae75ea07e4ef3b")
      }
      > z.myref.$id
      5191cc6684ae75ea07e4ef3b
      > z.myref.$ref
      people
      > z.myref.$db
      kamal
      

            Assignee:
            stephen.lee Stephen Lee
            Reporter:
            stephen.lee Stephen Lee
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: