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

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4.3
    • Component/s: Storage, Write Ops
    • Environment:
      Ubuntu 10.04 on x86
    • Linux
    • 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"} )

      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.

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

            Assignee:
            stephen.lee Stephen Lee
            Reporter:
            rkshakya Ravi Shakya
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: