Deal of The Day! 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

Posted by Karl on Feb 08, 2024 at 11:28 PM

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

Suggested Answer: A

Get Premium C100DBA Questions as Interactive Web-Based Practice Test or PDF Real Exam Format Detailed Explanations Instant Access Get Your Practice Test
28 comments · newest first
JU
Judy 10 months ago
I think there's a typo in that command.
TR
Truman 11 months ago
Looks good to me, but I’d double-check the syntax.
WI
Wilda 11 months ago
Wait, is `_id` really the best shard key?
EV
Evelynn 11 months ago
Totally agree, that's the right first step!
TO
Tonja 11 months ago
You need to use `sh.enableSharding("testdb")` first.
HA
Harrison 12 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`.
AL
Alyce 12 months ago
I feel like I might be mixing up the order of the commands. Was it `sh.shardCollection` before or after `sh.enableSharding`?
EL
Elliot 12 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 })`.
JE
Jess 1 year ago
I think the command to enable sharding is something like `sh.enableSharding("testdb")`, but I'm not completely sure about the syntax.
BO
Boris 1 year 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.
ST
Stevie 1 year 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.
GL
Glenn 1 year 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.
DA
Dana 1 year 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.
PH
Phyliss 1 year 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.
SE
Selma 1 year ago
This seems like a tricky question. I'll need to carefully analyze the options to identify the most likely trigger for the review.
JU
Julene 1 year 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.
AL
Alexis 1 year 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.
MA
Margurite 1 year ago
Pretty sure it's false because I recall discussing how enabling features can pose security risks if left default.
DA
Dawne 1 year 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?
CR
Crista 2 years ago
Great, I feel more confident now about setting up sharding on this database
LE
Leonida 2 years ago
That makes sense, because we need to specify the collection name within the 'shardCollection' command
LA
Lawanda 2 years ago
I think the correct command is sh.enableSharding("testdb") followed by sh.shardCollection("testdb.testCollection", {"_id": 1})
CR
Crista 2 years ago
But don't we also need to enable sharding on the 'testCollection' collection with '_id' as the shard key?
LE
Leonida 2 years ago
No, I believe it should be sh.enableSharding("testdb")
CR
Crista 2 years ago
I think the correct command is sh.shardCollection("testdb", "testCollection", {"_id": "hashed"})
LA
Lashon 2 years ago
That makes sense. Enabling sharding on 'testdb' and sharding 'testCollection' with '_id' as shard key will help distribute data efficiently.
BU
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})'.
CE
Celestine 2 years ago
I think the correct command to enable sharding on a database 'testdb' is 'sh.enableSharding('testdb')'.
0/2000 characters

Save Cancel