|
All of this has already been changed in 2.5.4:
> db.foo.update({ n : 9}, {$push: {x: {$each: [{"a.b" : 1}]}}}, true)
|
... "errmsg" : "a.b is not valid for storage.", ...
|
|
> db.foo.update({ n : 9}, {$push: {x: {$each: [{a:1},{a:2}], $xxx: -1, $sort:{a:1}}}})
|
... "errmsg" : "Unrecognized clause in $push: $xxx", ...
|
|
Unfortunately this is not testable in JS since it can't represent duplicate fields at the same level:
> update = {$push: {x:{$each:[{a:1},{a:2}], $slice:-2.0, $sort:{a:1}, $sort:{a:1}}}}
|
{ "$push" : {
|
"x" : {
|
"$each" : [
|
{ "a" : 1 },
|
{ "a" : 2 }
|
],
|
"$slice" : -2,
|
"$sort" : {
|
"a" : 1
|
}}}}
|
> db.foo.update({ n : 9},update)
|
Also, the push test seems fine (Note: our parser creates BSON which can contain repeated fields):
TEST(Init, PushEachDuplicateSortClause) {
|
const char* c = "{$push: {x:{$each:[{a:1},{a:2}], $slice:-2.0, $sort:{a:1}, $sort:{a:1}}}}";
|
BSONObj modObj = fromjson(c);
|
ModifierPush mod;
|
ASSERT_NOT_OK(mod.init(modObj["$push"].embeddedObject().firstElement(),
|
ModifierInterface::Options::normal()));
|
}
|
|