-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.11.3
-
Component/s: Error Handling
-
Labels:None
-
Environment:Windows and Linux, used through MATLAB
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()
> 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)