New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

MongoDB C100DBA Exam - 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:

0/2000 characters
Judy
3 months ago
I think there's a typo in that command.
upvoted 0 times
...
Truman
3 months ago
Looks good to me, but I’d double-check the syntax.
upvoted 0 times
...
Wilda
3 months ago
Wait, is `_id` really the best shard key?
upvoted 0 times
...
Evelynn
4 months ago
Totally agree, that's the right first step!
upvoted 0 times
...
Tonja
4 months ago
You need to use `sh.enableSharding("testdb")` first.
upvoted 0 times
...
Harrison
4 months ago
I vaguely recall that you need to specify the shard key correctly, but I can't remember if it should be `{ _id: 1 }` or just `_id`.
upvoted 0 times
...
Alyce
4 months ago
I feel like I might be mixing up the order of the commands. Was it `sh.shardCollection` before or after `sh.enableSharding`?
upvoted 0 times
...
Elliot
4 months ago
I remember practicing a similar question where we had to shard a collection, and I think the command was `sh.shardCollection("testdb.testCollection", { _id: 1 })`.
upvoted 0 times
...
Jess
5 months ago
I think the command to enable sharding is something like `sh.enableSharding("testdb")`, but I'm not completely sure about the syntax.
upvoted 0 times
...
Boris
5 months ago
No problem, this is straightforward. The commands you need are "sh.enableSharding('testdb')" and "sh.shardCollection('testdb.testCollection', {'_id': 1})" - that should do the trick.
upvoted 0 times
...
Stevie
5 months ago
Wait, I'm a little confused. Do I need to do anything else besides those two commands? I want to make sure I have the full solution.
upvoted 0 times
...
Glenn
5 months ago
Alright, I've got this. The correct command is "sh.enableSharding('testdb')" to enable sharding on the database, and then "sh.shardCollection('testdb.testCollection', {'_id': 1})" to shard the collection using the "_id" field.
upvoted 0 times
...
Dana
5 months ago
Okay, let me think this through step-by-step. First, I need to enable sharding on the "testdb" database. Then I can shard the "testCollection" collection using the "_id" field as the shard key.
upvoted 0 times
...
Phyliss
5 months ago
Hmm, this looks like a MongoDB question. I think I'll need to review my sharding commands to make sure I get this right.
upvoted 0 times
...
Selma
5 months ago
This seems like a tricky question. I'll need to carefully analyze the options to identify the most likely trigger for the review.
upvoted 0 times
...
Julene
5 months ago
Okay, I've got this. A SWOT analysis is used to understand the current state of things - the strengths, weaknesses, opportunities, and threats. That's option A, so I'm going with that.
upvoted 0 times
...
Alexis
5 months ago
This is a tricky one. I think Prisma Access might be a feature, but I'm not 100% sure. I'll select that as my third choice and hope for the best.
upvoted 0 times
...
Margurite
5 months ago
Pretty sure it's false because I recall discussing how enabling features can pose security risks if left default.
upvoted 0 times
...
Dawne
5 months ago
Utilization seems right, but for the other two, I keep mixing up optics and power consumption. Did we even cover all three in class?
upvoted 0 times
...
Crista
2 years ago
Great, I feel more confident now about setting up sharding on this database
upvoted 0 times
...
Leonida
2 years ago
That makes sense, because we need to specify the collection name within the 'shardCollection' command
upvoted 0 times
...
Lawanda
2 years ago
I think the correct command is sh.enableSharding("testdb") followed by sh.shardCollection("testdb.testCollection", {"_id": 1})
upvoted 0 times
...
Crista
2 years ago
But don't we also need to enable sharding on the 'testCollection' collection with '_id' as the shard key?
upvoted 0 times
...
Leonida
2 years ago
No, I believe it should be sh.enableSharding("testdb")
upvoted 0 times
...
Crista
2 years ago
I think the correct command is sh.shardCollection("testdb", "testCollection", {"_id": "hashed"})
upvoted 0 times
...
Lashon
2 years 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
2 years 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
2 years ago
I think the correct command to enable sharding on a database 'testdb' is 'sh.enableSharding('testdb')'.
upvoted 0 times
...

Save Cancel