To remove a document in a sharded collection, using the justOne option, the shard key is required. This works for the equality operator. Specify a comparison operator and it fails, i.e., $gte, $lt, with the following error:
WriteResult({ "nRemoved" : 0, "writeError" : { "code" : 61, "errmsg" : "delete { q: { a: { $gte: 6.0 } }, limit: 1 } does not contain _id or shard key for pattern { a: 1.0 }" } })
- related to
-
DOCS-5356 Sharding with remove/update specifying justOne/multi:false
- Closed