Test Online Free MongoDB C100DEV Exam Questions and Answers
Practice a live sample before buying full access. This page keeps the free C100DEV question set organized by page so visitors and search engines can reach the canonical -questions.html URL directly.
The following capped collection is given:
db.createCollection('latest_news', {'capped': true, 'size': 10000, 'max': 3})
[
{
_id: ObjectId("61e8007c9b3067e362440a88"),
title: 'COVID records broken again as weekend brings nearly 40K new cases'
},
{
_id: ObjectId("61e800989b3067e362440a89"),
title: 'Bitcoin, Ethereum, Dogecoin Face Fresh Round Of Regulatory Scrutiny'
},
{
_id: ObjectId("61e800d19b3067e362440a8a"),
title: 'Where Six Meme Stock Investors Are Now'
}
]
What the latest_news collection will look like after the following operation?
Suppose you added the following index to a products collection:
{ product_category: 1 }
Which of the following operations can potentially decrease performance?
Answer: Explanation:
The updateOne and insertOne operations are correct because adding indexes affects write performance.
Question 48Selectable Answer
Select true statements about the selection of the shard key.
Suppose we have a products collection with the following fields and values:
_id (automatically created ObjectId)
product_code (unique values for each product)
color (as String values)
size (this field is missing for some products)
origin_country
Which of these fields would be the best shard key?
Answer: Explanation:
With color, size, and origin_country we run the risk of low cardinality.
The _id wouldn't make a good shard key because it isn't something meaningful we could query the database.
https://docs.mongodb.com/manual/core/sharding-shard-key/
Question 50Selectable Answer
Given the following example document from an artists collection:
{
_id: 5,
last_name: 'Maurer',
first_name: 'Alfred',
year_born: 1868,
year_died: 1932,
nationality: 'USA'
}
and the following index:
db.artists.createIndex( { "last_name": 1, "nationality": 1 } )
How MongoDB will handle the query below?