[DOCS-1725] Document restrictions on write ops for sharded collections Created: 19/Jul/13  Updated: 30/Oct/23  Resolved: 07/Aug/13

Status: Closed
Project: Documentation
Component/s: manual
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Task Priority: Major - P3
Reporter: J Rassi Assignee: Sam Kleinman (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:
Days since reply: 10 years, 28 weeks, 1 day ago

 Description   

e.g.

mongos> sh.shardCollection("test.collection",{_id:"hashed"})
{ "collectionsharded" : "test.collection", "ok" : 1 }
mongos> db.collection.update({},{$set:{a:1}},{upsert:false,multi:false})
For non-multi updates, must have _id or full shard key ({ _id: "hashed" }) in query
mongos> db.collection.update({},{$set:{a:1}},{upsert:true,multi:true})
can't upsert something without full valid shard key : {}
mongos> db.collection.remove({},true)
can only delete with a non-shard key pattern if can delete as many as we find : {}
mongos>



 Comments   
Comment by auto [ 07/Aug/13 ]

Author:

{u'username': u'tychoish', u'name': u'Sam Kleinman', u'email': u'samk@10gen.com'}

Message: DOCS-1725: single document modification updates in sharded systems
Branch: master
https://github.com/mongodb/docs/commit/51c5490dbe6edee958b9213c516733b09771ddb6

Generated at Thu Feb 08 07:41:45 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.