MongoDB University - PreExamDBA3
MongoDB University - PreExamDBA3
Exam Overview
CRUD 4 1 5
Indexes 8 3 11
Server Administration 10 1 11
Application Administration 8 2 10
Replication 9 1 10
Sharding 9 1 10
Question 1
Indexes
A write concern of w: 2
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 1/65
28/10/2019 MongoDB University
Detailed Answer
Incorrect Options:
A write concern of w: 2
This secures the network between replica set nodes, but will not improve
read performance.
Correct Option:
Indexes
Question 2
Detailed Answer
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 2/65
28/10/2019 MongoDB University
Question 3
COPY
use services
db.restaurants.aggregate([
{
"$sort" : {"rating" : -1}
},
{
"$match": {
"reviews": { "$gte": 5 }
}
}
])
the sort order will be reversed to the direction of the shard key
Detailed Answer
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 3/65
28/10/2019 MongoDB University
The optimizer will re-order the match stage to before the sort.
CRUD
Question 1
Detailed Answer
Incorrect Answer:
Correct Answers:
$geoWithin
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 4/65
28/10/2019 MongoDB University
Question 2
COPY
{
_id: 1,
name: "Joe",
last: "Doe"
}
{
_id: 2,
name: "Jane",
last: "Doe"
}
{
_id: 3,
name: "Jeff",
last: "Doe"
}
COPY
db.employees.replaceOne(
{ "last": "Doe" },
{ "_id": 10, "name": { "first": "Walter", "last":
"Doe" } }
)
{
_id: 1,
name: "Joe",
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 5/65
28/10/2019 MongoDB University
name: Joe ,
last: "Doe"
}
{
_id: 2,
name: "Jane",
last: "Doe"
}
{
_id: 3,
name: "Jeff",
last: "Doe"
}
{
_id: 4,
name: "Walter",
last: "Doe"
}
{
_id: 10,
name: "Walter",
last: "Doe"
}
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 6/65
28/10/2019 MongoDB University
Detailed Answer
Incorrect Answers:
COPY
{
_id: 2,
name: "Jane",
last: "Doe"
}
COPY
{
_id: 3,
name: "Jeff",
last: "Doe"
}
This document will not be replaced because this is the third document to be
found by in the server. replaceOne will replace the first document found that
matches the query selector. Sorting the results by $natural provides the order
by which documents are selected without an explicit sort order.
COPY
{
_id: 4,
name: "Walter",
last: "Doe"
}
This document will not be replaced because it would not be found in the server
when executing replaceOne.
CO
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 7/65
28/10/2019 MongoDB University
COPY
{
_id: 10,
name: "Walter",
last: "Doe"
}
This document will not be replaced because it would not be found in the server
when executing replaceOne.
Correct Answer:
COPY
{
_id: 1,
name: "Joe",
last: "Doe"
}
This would be the first document to be returned by the query filter {last:
"Doe"} therefore the document to be replaced.
Question 3
COPY
db.employees.update({
"employee_id": 1244
}, {
$set: {
"employee_id": 1244,
"name": "Brad Pitt",
"salary_USD": 1200000
}
} {
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 8/65
28/10/2019 MongoDB University
}, {
upsert: true
})
The operation will insert a new document with _id equal to 1244.
The operation will not return an error, but the data in employees will
not change.
Detailed Answer
Correct Answer
This operation used the flag { upsert: true }, which performs an insert if
the matching document is not found. Because no document exists matching {
employee_id: 1244 }, the entire newEmployee document will be inserted as
a new document.
This document has a new _id, because there was no _id in the document
specified in the $set expression (employee_id does not count as _id).
Question 4
year
genre
_id
Detailed Answer
Correct Answers
year, _id
The year field was specified in the projection, and the _id field is returned by
default.
Incorrect Answers
genre
Because the field year was the only field specified in the projection, all other
fields (except _id) will be suppressed from result documents.
Question 5
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 10/65
28/10/2019 MongoDB University
the first document that matches the filter in sorted order by ObjectId
the last document that matches the filter in sorted order by ObjectId
Detailed Answer
When using deleteOne, the first document that matches the filter will be deleted.
If you want to delete the first document returned in the collection, you can
specify an empty document as a parameter.
Indexes
Question 1
COPY
db.songs.find(
{ "seconds": { "$lt": 400 }, "genre": "rock" }
).sort(
{ "rating": 1 }
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 11/65
28/10/2019 MongoDB University
Which index on the songs collection will be the most performant for the above
query?
Detailed Answer
The most efficient index for the given query should follow the equality, sort,
range rule, where the compound index is built in this order for a query that
employs equality, range and sort conditions in it. This rule helps to avoid
inefficient operations such as a full collection scan or in memory sort.
Question 2
When creating an index on a field with values of varying data types, how will the
values be sorted in this index?
Detailed Answer
Correct Answer:
The indexed values are grouped based on the data type representation first, that
way if we are traversing the tree, we can go directly to that branch of the tree
and get results in a more streamlined fashion
Incorrect Answers:
Question 3
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 13/65
28/10/2019 MongoDB University
Given a replica set and the following set of commands run from the secondary
node (port 27003, node name: r3) of the replica set:
COPY
use admin
db.shutdownServer()
r3 will get started and become part of the replica set again
this will restart the replica set with an additional node called r3
Detailed Answer
This is because the command did not include the --replSet option, even
though all other configurations stayed the same. All other answers are incorrect.
Question 4
Which of the following queries could use this index for filtering and sorting?
Detailed Answer
Correct Answers:
COPY
This answer is correct because the processor, price, and memoryGB form an
index prefix.
COPY
This answer is correct because the processor and price form an index prefix.
Incorrect Answer:
COPY
.sort( { memoryGB: -1 } )
This answer is incorrect because the price and memoryGB do NOT form an
index prefix.
Question 5
COPY
db.animals.find(
{},
{ "_id": 0, "species": 1, "name": 1,
"number_of_chromosomes": 1 }
).sort(
{ "number_of_chromosomes": -1 }
)
{ "number_of_chromosomes": 1 } COPY
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 16/65
28/10/2019 MongoDB University
Detailed Answer
Correct answer:
This is because when we are sorting with a single field index, we can always sort
our documents either in ascending or descending order regardless of the
physical ordering of the index keys.
Question 6
{ climate: 1 } COPY
Detailed Answer
Correct Answers:
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 17/65
28/10/2019 MongoDB University
These queries can use the index, because the query selector filters on
the "climate" field.
Incorrect Answer:
These queries can NOT use the index, because the query selector
does not filter on the "climate" field.
Question 7
Select the appropriate option(s) below that should always be kept in mind
regarding indexes:
Detailed Answer
All answers are correct. Indexes are critical for increased performance, but they
aren't free and must be considered when determining disk and memory
requirements for a deployment machine.
Question 8
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 18/65
28/10/2019 MongoDB University
COPY
db.createCollection(
"signs",
{ "collation": { "locale": "fr" } }
)
db.signs.createIndex(
{ "sign_text": 1 },
{ "collation": { "locale": "es" } }
)
db.signs.find(
{ "sign_text": "Bonjour Québec" },
{ "collation": { "locale": "en" } }
)
Detailed Answer
Correct Option:
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 19/65
28/10/2019 MongoDB University
Because the locale asked is not available, the mongod process will thrown
an error.
The find command could have used "fr", "fr_CA" or no locale, however it
can not use a locale that is not associated with the collection or its indexes.
Incorrect Options:
The server can not use 2 locales together for a given query, only one.
Question 9
allPlansExecution
executionStats
queryPlanner
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 20/65
28/10/2019 MongoDB University
Detailed Answer
Question 10
Your company operates a very popular movie review and recommendation site.
Queries for movie recommendations are becoming unacceptably slow. 90% of
queries are for movies with a viewer rating above 7 on a 1-10 scale. What type of
index is most appropriate to help speed up these queries?
text
partial
hashed
sparse
multi-key
Detailed Answer
The correct answer is partial. Partial indexes are especially useful when we want
to index a subset of our data, typically the most accessed portion.
Question 11
Which of the following commands will create an index that will cover the query?
db.records.createIndex( { "qty": 1 } )
Detailed Answer
Correct Option
db.records.createIndex( { "qty": 1 } )
This will create an index on the "qty" field, which will cover the range
query.
Incorrect Options:
Sorted is not an option you can pass to an index. Indexes are already
sorted, you can specify the direction of the sort using 1 or -1 when
creating the index.
Server Administration
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 22/65
Server Administration
28/10/2019 MongoDB University
Question 1
Which of the following would not be found in the combined results of explain()
commands run on every shard?
Detailed Answer
Correct Option:
You may see 2 or 3 alternate plans for a given query, however the output is
not listing the whole list of available indexes, only those few that it thinks
may be the best match. Run getIndexes() on your collection to see the
complete list
Incorrect Options:
All other options are incorrect, as they are important information you should first
look for when reading an explain() output.
Question 2
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 23/65
28/10/2019 MongoDB University
Consider a write operation that takes 150 milliseconds, and a database profiler
that uses the default value of slowms.
Which of the following profiler levels would cause the profiler to capture this
operation?
Detailed Answer
Correct Answers
This profiling level will record all operations that exceed the slowms
limit, which is 100ms by default.
This profiling level will record all operations, regardless of how long
they take.
Incorrect Answers
Question 3
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 24/65
28/10/2019 MongoDB University
COPY
db.runCommand({
rolesInfo: { role: "dbOwner", db: "admin" },
showPrivileges: true
})
List of roles granted that have privileges over the "admin" database
Detailed Answer
Correct Options:
Incorrect Option
List of roles granted that have privileges over the "admin" database
Question 4
Given BSON collection data and access to a database, which command could
you use to import that collection into the database?
mongoexport
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 25/65
28/10/2019 MongoDB University
o goe po t
mongorestore
mongostat
mongoimport
mongodump
Detailed Answer
mongorestore
All other answers are incorrect. - mongodump operates using data in BSON, but
it removes data, rather than adds it to the database. - mongoimport and
mongoexport operates using JSON and CSV, so neither will work in the given
scenario. - mongostat returns the statistics about the mongod server currently
running and thus will not aid in adding a collection to the database.
Question 5
1GB
100MB
there is no limit
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 26/65
28/10/2019 MongoDB University
Detailed Answer
100MB
Each journal file has a maximum size of 100MB, after which a new file is created.
When a new journal file is created, WiredTiger syncs the previous journal file.
Question 6
LDAP
X.509
SCRAM
Detailed Answer
The correct answers are SCRAM and X.509. LDAP, and Kerberos, are only
available in the Enterprise version of MongoDB.
Question 7
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 27/65
28/10/2019 MongoDB University
the use of the KMIP server that is running on the local machine
storage encryption
Detailed Answer
Correct Answers:
the use of the KMIP server that is running on the local machine
storage encryption
Incorrect Answers:
The KMIP server is a separate program that a mongod process can connect to,
but not start, hence this answer is incorrect.
Question 8
Which of the following statements is true with regard to the localhost exemption?
You need to use the mongod user to create additional users when
connecting to a mongod for the first time.
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 28/65
28/10/2019 MongoDB University
You can create the first user when connecting to a newly configured
mongod from localhost.
Detailed Answer
You can create the first user when connecting to a newly configured
mongod from localhost.
When you first connect to a newly configured mongod, you can create the first
user even if authentication is on. This user can then be used to create
subsequent users as needed.
Question 9
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 29/65
28/10/2019 MongoDB University
Grant roles to users with minimal access required for their tasks
Grant roles to users where they can explore the cluster features
Detailed Answer
Correct Option:
Grant roles to users with minimal access required for their tasks
Incorrect Options:
Grant roles to users where they can explore the cluster features
These two options are wrong because they imply the opposite of POLP.
Granting roles to users enforcing POLP does not imply restricting all
database users to read only mode. Quite the opposite, only read what they
need to read, and only write what the user needs to write.
Having a limited amount of users with root level access is a common sense
approach, but that should not be a strict rule. If you need to have more than
one user with a given role, either root or other roles, so be it. As long it is
absolutely necessary to have such role so the user can perform is expected
tasks.
Question 10
Detailed Answer
Correct Options:
Before you can issue the query to read a document, you would have been
authenticated. Now the server would verify that you are authorized to
access this document.
The operation of creating the user is also related to authorization. You will
be authorized to add this user, if you are granted the appropriate privileges
in this database.
Incorrect Option:
Question 11
You are setting up MongoDB and have enabled authorization with the following
setting in your configuration file
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 31/65
28/10/2019 MongoDB University
COPY
security:
authorization: enabled
Detailed Answer
Application Administration
Question 1
What is the correct audit filter document that will enable logging any time a
collection in a database is created or dropped?
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 32/65
28/10/2019 MongoDB University
"dropCollection"}]}
Detailed Answer
Correct Answer:
When creating an audit filter by action type, you have to use the "atype" field
using the "$in" operator to list the multiple operations that you are looking to
audit.
Question 2
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 33/65
28/10/2019 MongoDB University
use production
db.createCollection("test")
use test
db.dropCollection("games")
use test
db.createCollection("games")
Detailed Answer
Correct Option:
COPY
use test
db.createCollection("games")
This instruction will be logged in the audit log because both the audit namespace
is test.games and the action type createCollection are defined in the
auditFilter.
Incorrect Options:
COPY
use production
db.createCollection("test")
COPY
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 34/65
28/10/2019 MongoDB University
CO
use test
db.dropCollection("games")
In this case both the action dropCollection and the namespace test.games
are part of the audit filter. However, given the information that we have, we
cannot guarantee that the collection games exists in the test database,
therefore we cannot be sure that this command will be successful. The audit log
will only log successful operations, operations that complete. Given that we are
looking for operations that must be logged, we cannot tell for sure that this
would be a successful operation.
Question 3
When configuring a new replica set to use keyfile authentication, which of the
following applies?
The hostname in the keyfile for each node must match the hostname
for the host it is running on.
After starting the first member with keyfile authentication enabled, the
first user must be created via the localhost exception.
Detailed Answer
Correct answers
After you have started the first member with keyfile authentication enabled, you
must create the first user via the localhost exception.
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 35/65
28/10/2019 MongoDB University
Incorrect answers
The hostname in the keyfile for each node must match the hostname for the host
it is running on.
Question 4
COPY
$ mongo
use foundation
db.createUser({user: "daneel.olivaw", pwd:
"etodemerzel", roles: ["readWrite"]})
$ mongo
> use foundation
> db.auth("daneel.olivaw", "etodemerzel")
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 36/65
28/10/2019 MongoDB University
$ mongo test
> use foundation
> db.auth("daneel.olivaw", "etodemerzel")
Detailed Answer
COPY
This is the only commands that will not authenticate correctly. After the mongo
shell starts, it will land in the 'test' directory. The subsequent db.auth()
command will try to authenticate in this 'test' database, while it should do it in
'foundation' to succeed. The key thing to understand here is that --
authenticationDatabase only make sense if you are also providing the
credentials at the same time.
Question 5
Which of the following commands will successfully create the user braun and
give the user the appropriate privileges to import data in any collection of the
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 37/65
28/10/2019 MongoDB University
give the user the appropriate privileges to import data in any collection of the
nasa database?
Detailed Answer
Correct Options:
COPY
COPY
These 2 sets of commands will create the user "braun" with the appropriate
privileges. However, those 2 users will have to authenticate against different
databases.
Incorrect Option:
COPY
In this example, the user is created on the nasa database with privileges on the
admin database. This will not allow the user to import data into the nasa
database.
Question 6
You have a user "larry" who you would like to create a user defined role for. This
role needs to include privileges that apply to multiple databases. Where should
you create this role?
Detailed Answer
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 39/65
28/10/2019 MongoDB University
A role created in the admin database can include privileges that apply to the
admin database, other databases or to the cluster resource, and can inherit from
roles in other databases as well as the admin database. For that reason, if you
would like to create a role for "larry" that can be applied to multiple databases, it
needs to be created in the admin database
Question 7
Role name
Set of privileges
Inherited roles
Detailed Answer
Question 8
Select the resource definition that best describes all collections named
products in any database.
{ "collection": "products" }
Detailed Answer
Correct Option:
This resource definition document determines that any action over this resource
will be applied on all products collections created on any database.
Incorrect Options:
{ "collection": "products" }
Question 9
verify the client identity when connecting to the server using the
ca.pem file
Detailed Answer
sslPEMKeyFile Specifies the .pem file that contains the mongo shell's
certificate and key to present to the mongod or mongos instance.
--sslCAFile Specifies the Certificate Authority (CA) .pem file for verification of
the certificate presented by the mongod or the mongos instance.
Question 10
Transport layer
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 42/65
28/10/2019 MongoDB University
Password salting
Detailed Answer
Transport layer
Replication
Question 1
majority
linearizable
local
Detailed Answer
Correct Options:
majority read concern reads data that was written to a majority of nodes.
local read concern reads data at least written to the primary. It is the default
read concern
linearizable read concern reads data written to a majority of nodes prior to the
read request, and unlike majority will wait for pending write operations to
complete that would modify the document(s) requested
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 43/65
28/10/2019 MongoDB University
p y ( ) q
Question 2
Detailed Answer
Correct Answer
Incorrect Answers
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 44/65
28/10/2019 MongoDB University
Question 3
You are required to perform a rolling upgrade on your running replica set. You
have upgraded the secondaries and are now ready to upgrade the primary. What
rs.freeze()
rs.reconfig()
rs.slaveOk()
rs.stepDown()
rs.remove()
Detailed Answer
The correct answer is rs.stepDown(). This will insruct the primary that it
should step down. The primary will check there is an electable secondary and
wait if necessary for a secondary to catch up. It will then step down if safe to do
so.
Question 4
When connected to a replica set secondary node using the mongo shell, which of
the following set of commands will return successfully?
rs.setSlaveOk(); db.newcollection.insert({"name":
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 45/65
28/10/2019 MongoDB University
"Nathan"})
db.isMaster()
Detailed Answer
Incorrect Option:
rs.setSlaveOk(); db.newcollection.insert({"name":
"Nathan"})
Correct Options:
db.isMaster()
Question 5
Which command would you use to add an arbiter to an existing replica set on
host mongo2, running on port 27017?
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 46/65
28/10/2019 MongoDB University
rs.addArb("mongo2:27107")
Detailed Answer
Correct Option
rs.addArb("mongo2:27107") COPY
Incorrect Options:
Question 6
In a 3-node replica set, which of the following write concerns is more durable
than the default?
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 47/65
28/10/2019 MongoDB University
than the default?
w: 0
w: 1
w: 2
Detailed Answer
Correct answers:
w: 2
The default write concern is w: 1, and waiting for 2 nodes to apply a write is
more durable than only waiting for 1 node to apply it.
Incorrect answers:
w: 1
This is already the default Write Concern in MongoDB, so it does not represent a
higher durability than the default.
w: 0
This will not wait for any nodes to apply a write before sending an
acknowledgement, so it is a less durable write than the default value of w: 1.
Question 7
Consider a write operation performed against a replica set with write concern w:
1.
Detailed Answer
The write operation is more likely to take longer because the server has to
wait for acknowledgement from a majority of nodes in the replica set. This
typically takes longer than waiting for only one acknowledgement.
It is also less likely to be rolled back, because even if the primary node shuts
down, there is at least one other node that's applied the write operation.
Question 8
You have an application that does not need to have the most up to date data,
however you want to ensure that network latency between your client application
and the member it is reading from is minimized. Which read preference should
you set to achieve this goal?
secondary
primaryPreferred
nearest
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 49/65
28/10/2019 MongoDB University
Detailed Answer
Incorrect Options:
primaryPreferred
Secondary
Correct Option
nearest
nearest is the correct answer as it will read from the node with the lowest
network latency.
Question 9
oplog.rs
startup_log
system.replSet
Detailed Answer
Correct Answer
oplog.rs
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 50/65
28/10/2019 MongoDB University
Incorrect Answers
system.replSet
startup_log
Question 10
You have the following information for the members field in your replicaset
configuration document
COPY
"members" : [
{
"_id" : 0,
"host" : "acmecorp:27017",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"slaveDelay" : NumberLong(0),
"votes" : 1
},
{
"_id" : 1,
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 51/65
28/10/2019 MongoDB University
_ ,
"host" : "acmecorp:27018",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : true,
"priority" : 0,
"tags" : {
},
"slaveDelay" : NumberLong(3600),
"votes" : 0
},
{
"_id" : 2,
"host" : "acmecorp:27019",
"arbiterOnly" : false,
"buildIndexes" : true,
"hidden" : false,
"priority" : 1,
"tags" : {
},
"slaveDelay" : NumberLong(0),
"votes" : 1
}
],
Detailed Answer
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 52/65
28/10/2019 MongoDB University
Sharding
Question 1
Detailed Answer
Correct Answer:
Using a compound shard key creates more possibilities for the value
of the shard key, by using each unique combination of all the fields in
the key.
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 53/65
28/10/2019 MongoDB University
Incorrect Answers:
Adding more shards will decrease the load on each shard, but this
will not increase the cardinality of the shard key.
This will be a result of increasing the cardinality of the shard key, not
a cause.
Question 2
COPY
use config
db.chunks.findOne()
{
"_id": "test.sessions-abc-yxz",
"ns": "test.sessions",
"min": {
"userId": 1,
"sessionId": "US00001"
},
"max": {
"userId": 10,
"sessionId": "US00001"
}
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 54/65
28/10/2019 MongoDB University
},
"shard": "sh-1",
"lastmod": Timestamp(0,1),
"lastmodEpoch": ObjectId("ac78f355843b62a6d5a33a76")
}
Detailed Answer
Incorrect Options:
Correct Options:
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 55/65
28/10/2019 MongoDB University
Question 3
At which point does the balancer decide to start moving chunks from one shard
to another?
Detailed Answer
Correct Options:
Question 4
What is sharding?
Detailed Answer
Is an incorrect answer.
Question 5
You have sharded the collection users with the following command:
COPY
sh.shardCollection(
"app.users",
{ "userId": 1, "last_login": 1, "isActive": 1 }
)
Now you are tasked to help a colleague define which query predicate they
should use to address a given critical, low latency feature of the application.
Which of the following query predicates should they use to implement the
feature? (All of the following options are valid to implement the feature)
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 57/65
28/10/2019 MongoDB University
{"isActive": true}
{"name": {$exists: 1} }
Detailed Answer
Correct Option:
All other options would be scattered gathered queries, which are less
performant.
Question 6
scatter gather queries can be triggered by using your shard key in your
query predicates
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 58/65
28/10/2019 MongoDB University
the mongos has to go to each shard to check if the shard has the
requested documents
Detailed Answer
Incorrect Options:
scatter gather queries can be triggered by using your shard key in your query
predicates
Using the shard key in your query predicates prevents scatter gather
queries by routing the query to the correct shard. This is due to the config
server being aware of the distribution of the values across the cluster.
Scatter gather queries are not performant as the mongos has to go to each
shard to check if the requested documents are present.
Correct Option
the mongos has to go to each shard to check if the shard has the requested
documents
Not querying on your shard key causes scatter gather queries. As a result,
the mongos has no way of checking which shard the data resides on. This
causes the mongos needs to route the query to each shard to gather the
result set.
Question 7
COPY
{
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 59/65
28/10/2019 MongoDB University
{
find({"cast": "Meryl
Streep"}).sort({"year":1}).skip(100).limit(20)
}
And the following steps for executing such query in a sharded cluster:
Which of the following has the right steps, and in the right order?
Detailed Answer
Correct Answer:
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 60/65
28/10/2019 MongoDB University
route, sort_by_shard, limit_by_shard, sort_by_mongos, skip_by_mongos,
limit_by_mongos
Out of all the steps, the shards are not going to skip documents, because
skipping the first X documents only make sense on the final result set.
Remember the importance of having the shards responsible to sort their set,
because they likely have an index to produce the ordered set. The mongos, a
lighter process than the mongod, performs a merge sort, which is a rather
inexpensive operation compare to a complete sort.
The shards must limit to not only 20 documents, but also returned the potentially
skipped documents. For this reason, they will limit to the sum of the limit()
and skip() values.
Question 8
You have the following operational requirements and benchmarks within your
organization:
Detailed Answer
Scenario C: While the cost of vertically scaling is acceptable, we're already using
2.8TB of disk space. Considering we benchmarked a backup operation and
restore operation at 15 minutes each with 1.5TB of data, we're already beyond
our SLAs. Sharding should have already been considered much sooner.
Scenario A: This is a real world scenario that zone sharding was designed to
address, and depending on the type of information your organization stores you
may be subject to regulations requiring you to store data in a specific
geographical area. Considering the majority of users are located in the Americas
approaching SLA limits, sharding is more appropriate here than relocating all
data to the EU.
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 62/65
28/10/2019 MongoDB University
Question 9
Which of the following is the most important factor in choosing a shard key?
shard key for which the different values and their frequency are known
Detailed Answer
Correct Answer:
This is the most important criteria. There is often no perfect shard key, so
compromises may be needed.
If the workload is mostly reads, you want to identify the most frequent queries,
and ensure those get distributed and localized. The queries not using the shard
key will be sent to all shards. Those non-targeted queries do not scale well,
meaning adding a new shard is not helping, so we want to minimize those.
Incorrect Answers:
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 63/65
28/10/2019 MongoDB University
This will help you estimate the number of shards you may need, however not
help you identify the shard key.
This is true for a write intense workload, but may not be your priority in a read
intense workload.
shard key for which the different values and their frequency are known
You may not need to know the different values, however you need to have a
ballpark number on the cardinality of the values for your shard key.
That helps increase the cardinality and reduce the frequency, however is is not
mandatory. You may have a single field that already has good cardinality and
frequency.
Question 10
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 64/65
28/10/2019 MongoDB University
Detailed Answer
https://university.mongodb.com/exam/practice/DBA/results/5db6a2f5eb8883418df190da 65/65