Cyber Monday 2024! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

MongoDB Exam C100DBA Topic 1 Question 81 Discussion

Actual exam question for MongoDB's C100DBA exam
Question #: 81
Topic #: 1
[All C100DBA Questions]

Write the command(s) are correct to enable sharding on a database "testdb" and shard a collection "testCollection" with _id as shard key.

Show Suggested Answer Hide Answer
Suggested Answer: A

Contribute your Thoughts:

Crista
6 months ago
Great, I feel more confident now about setting up sharding on this database
upvoted 0 times
...
Leonida
6 months ago
That makes sense, because we need to specify the collection name within the 'shardCollection' command
upvoted 0 times
...
Lawanda
6 months ago
I think the correct command is sh.enableSharding("testdb") followed by sh.shardCollection("testdb.testCollection", {"_id": 1})
upvoted 0 times
...
Crista
6 months ago
But don't we also need to enable sharding on the 'testCollection' collection with '_id' as the shard key?
upvoted 0 times
...
Leonida
7 months ago
No, I believe it should be sh.enableSharding("testdb")
upvoted 0 times
...
Crista
7 months ago
I think the correct command is sh.shardCollection("testdb", "testCollection", {"_id": "hashed"})
upvoted 0 times
...
Lashon
7 months ago
That makes sense. Enabling sharding on 'testdb' and sharding 'testCollection' with '_id' as shard key will help distribute data efficiently.
upvoted 0 times
...
Burma
7 months ago
Yes, I agree with Celestine. And to shard a collection with '_id' as shard key, the command should be 'sh.shardCollection('testdb.testCollection', {_id: 1})'.
upvoted 0 times
...
Celestine
7 months ago
I think the correct command to enable sharding on a database 'testdb' is 'sh.enableSharding('testdb')'.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77