Bad $set update of nested fields fails but throws no error

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 2.11.3
    • Component/s: Error Handling
    • None
    • Environment:
      Windows and Linux, used through MATLAB
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Trying to update a nested field of an object that already exists as a value type, will result in an error when executed from the mongo shell:

      > doc =

      {t1:null} { "t1" : null }

      > db.test.insert(doc)
      > db.test.find()

      { "_id" : ObjectId("529c58a9642f618ff689a5eb"), "t1" : null }

      > db.test.update(

      { "_id" : ObjectId("529c58a9642f618ff689a5eb")}

      ,{"$set":{"t1.t2":1}})
      LEFT_SUBFIELD only supports Object: t1 not: 10

      Trying the same with the JAVA driver (which I access from MATLAB, but I suppose native JAVA would be similar):
      >> doc(1) = BasicDBObject('t1','');
      >> db.getCollection('test').insert(doc)
      >> db.getCollection('test').update(BasicDBObject('_id',doc(1).get('_id')),BasicDBObject('$set',BasicDBObject('t1.t2',1)))

      This fails but returns no error (also other valid fields in doc won't be updated)

            Assignee:
            Unassigned
            Reporter:
            Zohar Bar-Yehuda
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: