Details
-
Improvement
-
Resolution: Duplicate
-
Major - P3
-
None
-
None
-
None
-
Query
Description
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.
Attachments
Issue Links
- duplicates
-
SERVER-13843 Upsert fails with error when query document includes multiple equality predicates on same field
-
- Backlog
-