|
Eric: That's a separate problem, which appears to be fixed in SERVER-2651.
FWIW, my first impression about this: while it's probably not a great idea to use blank keys, it seems like MongoDB's dot syntax does support it ("foo..x"), and it'd be nice to not introduce more limitations into Mongo's vocabulary compared to JSON's than necessary.
|
> db.left.insert({field1: "whatever", "": null, "field2": "test"})
|
> db.left.insert({field1: "whatever", "blah": null, "field2": "test"})
|
> db.left.find()
|
|
{ "_id" : ObjectId("4ecbd79b0bc92511fe2bd457"), "field1" : "whatever", "" : null, "field2" : "test" }
|
|
{ "_id" : ObjectId("4ecbd7a70bc92511fe2bd458"), "field1" : "whatever", "blah" : null, "field2" : "test" }
|
|
> db.left.find({"field1": "whatever"})
|
|
{ "_id" : ObjectId("4ecbd79b0bc92511fe2bd457"), "field1" : "whatever", "" : null, "field2" : "test" }
|
|
{ "_id" : ObjectId("4ecbd7a70bc92511fe2bd458"), "field1" : "whatever", "blah" : null, "field2" : "test" }
|
|
> db.left.update({"field1": "whatever"}, {$set: {"field2": "test2"}}, false, true)
|
|
LEFT_SUBFIELD only supports Object: not: 10
|
|
> db.left.remove({"_id": ObjectId("4ecbd79b0bc92511fe2bd457")})
|
> db.left.update({"field1": "whatever"}, {$set: {"field2": "test2"}}, false, true)
|
> db.left.find()
|
|
{ "_id" : ObjectId("4ecbd7a70bc92511fe2bd458"), "blah" : null, "field1" : "whatever", "field2" : "test2" }
|
|
> db.left.insert({field1: "whatever", "": null, "field2": "test"})
|
> db.left.update({"field1": "whatever"}, {$set: {"field2": "test2"}}, false, true)
|
This blurb demonstrates the inconsistency between allowing documents to be created with an empty string LEFT_SUBFIELD and the error thrown by updates when provided. Apologies for extra edits for formatting.
|