Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
1.2.1
-
None
-
None
-
no matter
Description
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.