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

Allow Arbitrary Properties on DBRefs

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.3.3
    • Affects Version/s: None
    • Component/s: JavaScript
    • None

      DBRefs are supposed to be informal, allowing arbitrary properties in addition to $ref, $db, and $id. The database stores them correctly, but the JavaScript shell silently drops them from output. This can be shown by importing data containing an "extra" property, performing a search for records with this set to 1 (demonstrating that the database handles it correctly), and then printing the value of "extra".

      To reproduce:

      > echo '{ otherobj :

      { "$ref" : "othertable", "$id" : "notimportant", extra : 1 }

      }' > test.json
      > mongoimport -h localhost -d test -c test test.json
      > mongo localhost/test --eval "printjson(db.test.findOne(

      {\"otherobj.extra\":1}

      ).extra)"

      The last line should return "1", it currently returns "null".

            Assignee:
            aaron Aaron Staple
            Reporter:
            ynniv Vinny Fiano
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: