-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.2.1
-
Component/s: None
-
Labels:None
-
Environment:no matter
I want to add object with CERTAIN _id if object doesn't exist. Else, I want to use $set on it's properties.
What should I do?
> db.chatsessions.update(
{"_id": "test"},
{"_id":"test"},
{upsert: true});
> db.chatsessions.find();
<_id": "test1"},{"_id":"test1","$set":{"key": "value"}},
{upsert: true});
Modifiers and non-modifiers cannot be mixed
> db.chatsessions.update(
,{"$set":{"_id": "test1", "key": "value"}},
{upsert: true});
Mod on _id not allowed
>
I think that the error "Modifiers and non-modifiers cannot be mixed" shouldn't occur in case of _id.
In case that an object exists already, _id should be ignored.