-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
None
-
Query
Take the following update:
db.test.update( {"someField" : {"$all": ["a", "b"]}}, {"$addToSet": {"someOtherField": 123}, "$setOnInsert": {"someField": ["a", "b"]}}, {"upsert": true})
This results in the following error, because of the $all query:
"writeError" : { "code" : 54, "errmsg" : "cannot infer query fields to set, path 'someField' is matched twice"}
Given that I explicitly stated what I want the value for someField to be using $setOnInsert, it doesn't have to be a problem that the value can't be inferred from the query. It could just use value I specified as a fallback for inference, or even instead of inference.
- duplicates
-
SERVER-13843 Upsert fails with error when query document includes multiple equality predicates on same field
- Backlog