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.
We have an accounts collection with only one document:
{
_id: 54657,
account_id: 557378,
products: [ 'InvestmentStock', 'Commodity', 'CurrencyService' ]
}
We need to use Aggregation Framework to unwind the products Array to obtain new documents with
only one product per document (see below).
Expected output:
[
{ _id: 54657, account_id: 557378, products: 'InvestmentStock' },
{ _id: 54657, account_id: 557378, products: 'Commodity' },
{ _id: 54657, account_id: 557378, products: 'CurrencyService' }
]
Which pipeline should you use?
You have the following index in a movies collection:
{ "title": 1, "imdb.rating": -1, "imdb.votes": -1, "type": 1 }
Can the following query use the given index for both filtering and sorting?
Answer: Explanation:
Yes, this query can use the index prefix. The order of the fields in the query predicate does not matter.
Since both "imdb.rating" and "title" are part of an index prefix, this query can use the index for an equality condition.
https://docs.mongodb.com/manual/indexes/
Question 7Selectable Answer
Suppose you insert the following documents into companies collection:
db.companies.insertMany([
{"_id": 1, "name": "Facebook"},
{"_id": 1, "name": "Twitter"},
{"_id": 2, "name": "Tesla"},
{"_id": 3, "name": "Amazon"}
], {"ordered": false})
Select all true statements about this operation. (select 3)
Suppose you have a companies collection in your database. Only the following documents are stored in
this collection:
{
_id: ObjectId("52cdef7c4bab8bd675297da4"),
name: 'Powerset',
category_code: 'search',
founded_year: 2006
},
{
_id: ObjectId("52cdef7c4bab8bd675297da5"),
name: 'Technorati',
category_code: 'advertising',
founded_year: 2002
},
{
_id: ObjectId("52cdef7c4bab8bd675297da7"),
name: 'AddThis',
category_code: 'advertising',
founded_year: 2004
},
{
_id: ObjectId("52cdef7c4bab8bd675297da8"),
name: 'OpenX',
category_code: 'advertising',
founded_year: 2008
},
{
_id: ObjectId("52cdef7c4bab8bd675297daa"),
name: 'Sparter',
category_code: 'games_video',
founded_year: 2007
},
{
_id: ObjectId("52cdef7c4bab8bd675297dac"),
name: 'Veoh',
category_code: 'games_video',
founded_year: 2004
},
{
_id: ObjectId("52cdef7c4bab8bd675297dae"),
name: 'Thoof',
category_code: 'web',
founded_year: 2006
}
What is the default sort order in the result set returned in response to the following query?
You have the following config file:
storage:
dbPath: /data/db
systemLog:
destination: file
path: /var/log/mongod.log
net:
bindIp: localhost,192.168.168.62
security:
keyFile: /var/pki/keyfile
processManagement:
fork: true
Select all the directories that MongoDB must have access to
There is a gamers collection in your database with the following document structure:
{ _id: 1, level: 15, is_active: true },
{ _id: 2, level: 14, is_active: true },
{ _id: 3, level: 7, is_active: false }
How do you increase the value of the level field by 20 for a player with id = 3?