From a recent question in training: "what happens if you try to use the positional operator with upsert?". It appears it can create an invalid document with a dollarsign in the field name:
db.foo.update(
{ 'x.a' : 6 }, { $set :
{ 'x.$.b' : -5 } }, true )
db.foo.find().pretty()
{
"_id" : ObjectId("4f1724449afa61972cf8ef0b"),
"x" : {
"$" :
,
"a" : 6
}
}
- related to
-
SERVER-6669 update lacking positional match creates bad document
- Closed