[SERVER-3565] Improve error message when trying to shard on non-existent field Created: 09/Aug/11  Updated: 12/Jul/16  Resolved: 13/Oct/11

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 1.8.2
Fix Version/s: 2.1.0

Type: Improvement Priority: Minor - P4
Reporter: Daniel Pasette (Inactive) Assignee: Greg Studer
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File shard_null.js    
Participants:

 Description   

If any of the shard keys don't exist, the error message is fairly opaque. Could it mention the document _id.

> db.runCommand( { shardcollection : "" + coll, key :

{ bucketId : 1, entityId : 1, variationId : 1 }

} )

{ "ok" : 0, "errmsg" : "exception: invalid parameter: expected an object ()" }

 Comments   
Comment by auto [ 13/Oct/11 ]

Author:

{u'login': u'gregstuder', u'name': u'gregs', u'email': u'greg@10gen.com'}

Message: SERVER-3565 don't get _id from shard key, get from doc
Branch: master
https://github.com/mongodb/mongo/commit/ffa338a9df43b42e94cff3d032d9aab5c4c57f22

Comment by Greg Studer [ 13/Oct/11 ]

actually this was the intention of the original code, but accidentally tries to get id of shard key object itself, hence the weird error.

Comment by auto [ 13/Oct/11 ]

Author:

{u'login': u'gregstuder', u'name': u'gregs', u'email': u'greg@10gen.com'}

Message: SERVER-3565 don't shard with sparse shard key index
Branch: master
https://github.com/mongodb/mongo/commit/b9a31adaf216643f687a3a70cf96530e11785b5e

Comment by Greg Studer [ 13/Oct/11 ]

Also shouldn't be able to shard over sparse collections.

Generated at Thu Feb 08 03:03:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.