-
Type: Task
-
Resolution: Won't Do
-
Priority: Major - P3
-
Affects Version/s: 3.4.0
-
Component/s: manual
-
Labels:None
According to the mongos manual,
db.collection.update({}, {},
) command always boradcast to all shard.
https://docs.mongodb.com/manual/core/sharded-cluster-query-router/
>> Multi-update operations are always broadcast operations.
And db.collection.update manual said, db.collection.update({}, {},
{multi:true}) always need shard key for sharded collection.
https://docs.mongodb.com/v3.2/reference/method/db.collection.update/#multi-parameter
>> Sharded Collections
>> All update() operations for a sharded collection must include the shard key or the _id field
>> in the query specification. update() operations without the shard key or the _id field
>> return an error.
I think two document's explains are conflicted. why multi-update need shard key condition even they can't be targeted query.
And according to the mongos manual (above link), updateMany() and deleteMany() can be target query if full shard key condition is provided. then why multi-update can't be target query. Is there any differences between updateMany() and db.collection.update({}, {},
{multi:true}) ?