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

Allow Arbitrary Properties on DBRefs

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 1.3.3
    • None
    • JavaScript
    • None

    Description

      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".

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: