Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
1.8.2, 2.0.2
-
None
-
Fedora 16 x86_64
-
ALL
Description
On an unsharded database you can update a document without having to pass in the _id as a value in the update document. The new document will retain the old _id. For sharded collections if you want to update a document you have to include the _id (or whatever your shard key is) or you will get an error.
use admin
db.runCommand(
);
db.runCommand( { shardcollection : "test.coll", key : {_id : 1} } );
use test
db.coll.insert(
)
db.coll.update(
,
{"num" : 2})
results in:
valid shard key must be in update object for collection: test.coll