-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Environment:3 servers with 3 shards.
-
Empty show more show less
I'm trying to shard a collection using the mongodb nodejs drive.
Instead of using the admin ctor, I opened a connection directly to the 'admin' db and issued the following command:
db.command({shardCollection: 'foo.bar', key: {k:1}})
I then used the mongo console and issued db.printShardingStatus().
The result:
foo.bar chunks:
mongo1 1
{ "[object Object]" :
} -->> { "[object Object]" :
{ $maxKey : 1 } } on
: mongo1
you can see above that the sharding key object isn't being serialized. and remains [object Object].
Had I used the mongo console with the same command, the result would have been:
The result:
foo.bar chunks:
mongo1 1
{ "k" :
} -->> { "k" :
{ $maxKey : 1 } } on
: mongo1
where instead of "[object Object]" there was the right "k"
I digged in the driver and saw that for creating indexes, the driver takes extra effort to serialize them. (db_command.js -> DbCommand.createCreateIndexCommand)
I guess this is what missing for the shardCollection method for the 'key' property.
am I doing something wrong? or is this just not supported ?
If not, does this feature planned to be enabled in the near future?
Please help
Thanks you,
Uri