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

$db values for DBRef datatype does not seem to persist in mongo collection

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.4.3
    • Fix Version/s: None
    • Component/s: Storage, Write Ops
    • Labels:
    • Environment:
      Ubuntu 10.04 on x86
    • Operating System:
      Linux
    • Steps To Reproduce:
      Hide

      1) Create a collection named 'people' in database 'kamal' and insert a doc as
      db.people.insert({_id : ObjectId('5191cc6684ae75ea07e4ef3b'), "name" : "Tu"})
      2) Now in another database, insert a document into collection named 'halloa' as follows:
      db.halloa.insert({"name" : "dukur", "myref" :

      {"$ref" : "people", "$id" : "5191cc6684ae75ea07e4ef3b", "$db" : "kamal"}

      })
      3) Retrieve the document using following query:
      db.halloa.find(

      {"name" : "dukur"}

      )

      Show
      1) Create a collection named 'people' in database 'kamal' and insert a doc as db.people.insert({_id : ObjectId('5191cc6684ae75ea07e4ef3b'), "name" : "Tu"}) 2) Now in another database, insert a document into collection named 'halloa' as follows: db.halloa.insert({"name" : "dukur", "myref" : {"$ref" : "people", "$id" : "5191cc6684ae75ea07e4ef3b", "$db" : "kamal"} }) 3) Retrieve the document using following query: db.halloa.find( {"name" : "dukur"} )

      Description

      While storing a DBRef datatype with all the 3 values i.e. $ref, $id and $db values into a collection, $db does not seem to have been stored.
      When i retrieve the doc, I could see $ref and $id values but not $db values. Please refer to the attached screenshots.

        Attachments

        1. document_stored.png
          document_stored.png
          20 kB
        2. insert_DBRef.png
          insert_DBRef.png
          27 kB

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: