Collection a :
{ "_id" : ObjectId("5ac74fe36b5973701b9ec7f7"), "tutu" : [ 0, 1 ] }
> a.update({}, {$inc:{"tutu.$[]":1}})
WriteResult({
"nMatched" : 0,
"nUpserted" : 0,
"nModified" : 0,
"writeError" : {
"code" : 16837,
"errmsg" : "cannot use the part (tutu of tutu.$[]) to traverse the element ({tutu: [ 0.0, 1.0 ]})"
}
})Is this a mongo 3.6 bug or a mistyping in the documentation?
Hi Maxime,
I couldn’t replicate the problem that you’re seeing on MongoDB v3.6.3:
> db.a.insert({tutu:[0, 1]});
WriteResult({
"nInserted": 1
})
> db.a.update({}, {$inc:{"tutu.$[]":1}})
WriteResult({
"nMatched": 1,
"nUpserted": 0,
"nModified": 1
})
> db.a.find()
{"_id": ObjectId("5acaafba311a74ec454207a7"), "tutu": [1,2]}
Could you check whether you're using MongoDB v3.6.3 ?
Regards,
Wan.
> To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@googlegroups.com.
Hi,
I tried with mongodb 3.6.4 from community repositories on debian, it's still not working. I'm gonna try with a clean install.