C100DBA : MongoDB Certified DBA Associate – Latest Dumps

CRUD: Question 1

Which of the documents below will be retrieved by the following query? Assume the documents are stored in a collection called “sample”. Check all that apply.

db.sample.find( { "$or" : [ { "a" : { "$in" : [ 3, 10] } }, { "b" : { "$lt" : 2 } } ] } )

CRUD: Question 2

Consider the following example document from the sample collection. All documents in this collection have the same schema.

{
    "_id" : 3, 
    "a" : 7,
    "b" : 4
}

Which of the following queries will replace this with the document,

{
    "_id" : 7, 
    "c" : 4
}

CRUD: Question 3

You perform the following query on the sayings collection, which has the index { quote : “text” }:

db.sayings.find( { $text : { $search : "fact find" } } )

Assuming the following documents are in the collection, which ones will the query return? Check all that apply.

CRUD: Question 4

Which of the documents below would be modified by the following update? Assume all documents are in the “people” collection. Check all that apply.

> db.people.updateMany( { "city" : "Seattle", "state" : "WA" }, { "$addToSet" : { "likes" : "forest" } } )

CRUD: Question 5

Which of the following queries on the “team” collection will return only the first five elements of the array in the “scores” field?

Example document (as it exists in the collection):

> db.team.find()
{ "_id" : 12, scores : [ 3, 5, 7, 2, 1, -4, 3, 12 ] }

Document you want returned by your query:

{ "_id" : 12, "scores" : [ 3, 5, 7, 2, 1 ] }

CRUD: Question 6

On which of the following CRUD operations can you specify a write concern? Check all that apply.

INDEXES: Question 1

Which of the following is true of covered queries? Check all that apply.

INDEXES: Question 2

Which of the following statements are true of unique indexes? Check all that apply.

INDEXES: Question 3

You have the following indexes on your collection:

[
	{
		"v" : 1,
		"key" : {
			"_id" : 1
		},
		"name" : "_id_",
		"ns" : "test.sample"
	},
	{
		"v" : 1,
		"key" : {
			"name" : 1,
			"date" : 1,
			"phone" : 1
		},
		"name" : "name_1_date_1_phone_1",
		"ns" : "test.sample"
	}
]

Which of the following queries will use an index? Check all that apply.

INDEXES: Question 4

Adding an index on { a : 1 } can potentially decrease the speed of which of the following operations? Check all that apply.

INDEXES: Question 5

You have the following indexes on the things collection:

[
	{
		"v" : 1,
		"key" : {
			"_id" : 1
		},
		"name" : "_id_",
		"ns" : "test.things"
	},
	{
		"v" : 1,
		"key" : {
			"a" : 1
		},
		"name" : "a_1",
		"ns" : "test.things"
	},
	{
		"v" : 1,
		"key" : {
			"c" : 1,
			"b" : 1,
			"a" : 1
		},
		"name" : "c_1_b_1_a_1",
		"ns" : "test.things"
	}
]

Which of the following queries will require that you load every document into RAM in order to fulfill the query? Assume that no data is being written during the query. Check all that apply.

INDEXES: Question 6

You have the following index on the toys collection:

{ 
    "manufacturer" : 1,
    "name" : 1,
    "date" : -1
}

Which of the following queries are able to use the index? Check all that apply.

INDEXES: Question 7

Which of the following must be true for a query to be a covered query? Check all that apply.

INDEXES: Question 8

You have created the following index on the foo collection:

> db.foo.createIndex( { a : 1, b : -1, c : -1, d: 1 } )

Which of the following queries will be able to fulfill the query without an in-memory sort (i.e., it’s able to use the index to sort)? Check all that apply.

INDEXES: Question 9

Given the following example document:

{
  "_id": ObjectId("5360c0a0a655a60674680bbe"),

  "user": {
    "login": "ir0n",
    "description": "Made of metal"
    "date": ISODate("2014-04-30T09:16:45.836Z"),
  }
}

and the following index:

db.users.createIndex( { "user.login": 1, "user.date": -1 }, "myIndex" )

When performing the following query:

db.users.find( { "user.login": /^ir.*/ }, { "user":1, "_id":0 } ).sort( { "user.date":1 } )

Which of the following statements correctly describes how MongoDB will handle the query?

INDEXES: Question 10

Suppose you have a collection “sample” with an index created as follows.

db.sample.createIndex( { "foo" : -1 } )

For which of the following queries can MongoDB efficiently look at only a subset of the index entries, rather than all of the index entries? Check all that apply.

AGGREGATION: Question 1

Suppose you have the following collection in MongoDB. The collection is named alpha.

{"_id" : 1, "region" : "NW1", "leads" : 1, "email" : "mlangley@co1.com"}
{"_id" : 2, "region" : "NW1", "leads" : 1, "email" : "jpicoult@co4.com"}
{"_id" : 3, "region" : "NW1", "leads" : 2, "email" : "zzz@company2.com"}
{"_id" : 4, "region" : "SE1", "leads" : 8, "email" : "mary@hssu.edu" }
{"_id" : 5, "region" : "SE2", "leads" : 4, "email" : "janet@col.edu"}
{"_id" : 6, "region" : "SE2", "leads" : 2, "email" : "bill@uni.edu"}
{"_id" : 7, "region" : "SE2", "leads" : 4, "email" : "iii@company1.com"}
{"_id" : 8, "region" : "SW1", "leads" : 1, "email" : "phil@co3.com"}
{"_id" : 9, "region" : "SW1", "leads" : 2, "email" : "thomas@company.com"}
{"_id" : 10, "region" : "SW2", "leads" : 2, "email" : "sjohnson@uchi.edu"}
{"_id" : 11, "region" : "SW2", "leads" : 5, "email" : "tsamuel@someco.com"}

How many documents will be returned in the result set in response to the following aggregation query?

db.alpha.aggregate( [
                   { "$group" : { "_id" : "$region" , 
                                  "count" : { "$sum" : 1 } } } ,
                   { "$match" : { "count" : { "$gte" : 3 } } } 
                  ] )

AGGREGATION: Question 2

Which of the following statements are true about the $match pipeline stage? Check all that apply.

AGGREGATION: Question 3

The users collection contains the following documents:

> db.users.find()
{ "_id" : 1, "name" : "dave123", "q1" : true, "q2" : true }
{ "_id" : 2, "name" : "dave2", "q1" : false, "q2" : false }
{ "_id" : 3, "name" : "ahn", "q1" : true, "q2" : true }
{ "_id" : 4, "name" : "li", "q1" : true, "q2" : false }
{ "_id" : 5, "name" : "annT", "q1" : false, "q2" : true }
{ "_id" : 6, "name" : "li", "q1" : true, "q2" : true }
{ "_id" : 7, "name" : "ty", "q1" : false, "q2" : true }

You perform the following query:

db.users.aggregate( [ { $sample : { size : 3 } } ] )

Which of the following are possible outputs from the database? Check all that apply.

{ "_id" : 7, "name" : "ty", "q1" : false, "q2" : true }
{ "_id" : 2, "name" : "dave2", "q1" : false, "q2" : false }
{ "_id" : 4, "name" : "li", "q1" : true, "q2" : false }

{ "_id" : 1, "name" : "dave123", "q1" : true, "q2" : true }
{ "_id" : 2, "name" : "dave2", "q1" : false, "q2" : false }
{ "_id" : 3, "name" : "ahn", "q1" : true, "q2" : true }

{ "_id" : 5, "name" : "annT", "q1" : false, "q2" : true }
{ "_id" : 6, "name" : "li", "q1" : true, "q2" : true }
{ "_id" : 7, "name" : "ty", "q1" : false, "q2" : true }

AGGREGATION: Question 4

Suppose you have the following collection with only 2 documents:

> db.people.find()
{ "_id" : "apples", "traits" : [ "sweet" , "crispy" ] }
{ "_id" : "oranges", "traits" : [ "sweet" , "orange" , "juicy" ] }

You run an aggregation query and begin with { $unwind : “$traits” } .

How many documents will you have in the pipeline after the $unwind stage?

REPLICATION: Question 1

Which of the following describe the primary reasons MongoDB supports replication? Check all that apply.

REPLICATION: Question 2

What is the principal advantage of having a delayed replica set member?

REPLICATION: Question 3

The people collection contains the following documents:

{ "_id" : ObjectId("57fd59a2d630a0fd9685a148"), "firstName" : "Arthur", "lastName" : "Aaronson", "state" : "WA", "city" : "Seattle", "likes" : [ "dogs", "cats" ] }
{ "_id" : ObjectId("57fd59a2d630a0fd9685a149"), "firstName" : "Beth", "lastName" : "Barnes", "state" : "WA", "city" : "Richland", "likes" : [ "forest", "desert" ] }
{ "_id" : ObjectId("57fd59a2d630a0fd9685a14a"), "firstName" : "Charlie", "lastName" : "Carlson", "state" : "CA", "city" : "San Diego", "likes" : [ "desert", "beach" ] }
{ "_id" : ObjectId("57fd59a2d630a0fd9685a14b"), "firstName" : "Dawn", "lastName" : "Davis", "state" : "WA", "city" : "Seattle", "likes" : [ "forest", "mountains" ] }

You perform the following query:

db.people.deleteMany( { state : "NB" } ) 

How many oplog entries are created as a result of this query?

REPLICATION: Question 4

What settings can be controlled by rs.reconfig()? Check all that apply.

REPLICATION: Question 5

Which of the following is a correct definition for idempotence?

REPLICATION: Question 6

Suppose you have a three-node replica set distributed across two data centers: dc1 and dc2. Which of the configurations below meets the following requirements:

  1. Your replica set maintains three copies of the data.
  2. Either dc1-01 or dc1-02 may become primary.
  3. dc2-01 should never be primary.
  4. Clients may read from dc2-01.

{ "_id" : "rs0", 
  "version" : 1, 
  "members" : [ 
    { "_id" : "dc1-01", "host" : "mongodb0.example.net:27017" }, 
    { "_id" : "dc1-02", "host" : "mongodb1.example.net:27017" }, 
    { "_id" : "dc2-01", "host" : "mongodb2.example.net:27017" } ] }

{ "_id" : "rs0", 
  "version" : 1, 
  "members" : [ 
    { "_id" : "dc1-01", "host" : "mongodb0.example.net:27017",
      "priority" : 1 }, 
    { "_id" : "dc1-02", "host" : "mongodb1.example.net:27017",
      "priority" : 0 }, 
    { "_id" : "dc2-01", "host" : "mongodb2.example.net:27017",
      "priority" : 0 } ] }  

{ "_id" : "rs0", 
  "version" : 1, 
  "members" : [ 
    { "_id" : "dc1-01", "host" : "mongodb0.example.net:27017" }, 
    { "_id" : "dc1-02", "host" : "mongodb1.example.net:27017" }, 
    { "_id" : "dc2-01", "host" : "mongodb2.example.net:27017",
      "hidden" : 1 } ] }

{ "_id" : "rs0", 
  "version" : 1, 
  "members" : [ 
    { "_id" : "dc1-01", "host" : "mongodb0.example.net:27017" }, 
    { "_id" : "dc1-02", "host" : "mongodb1.example.net:27017" },     
    { "_id" : "dc2-01", "host" : "mongodb2.example.net:27017",
      "priority" : 0 } ] }

{ "_id" : "rs0", 
  "version" : 1, 
  "members" : [ 
    { "_id" : "dc1-01", "host" : "mongodb0.example.net:27017" }, 
    { "_id" : "dc1-02", "host" : "mongodb1.example.net:27017" }, 
    { "_id" : "dc2-01", "host" : "mongodb2.example.net:27017",
      "arbiterOnly" : 1 } ] }

REPLICATION: Question 7

Which of the following are true of the Oplog entries created as a result of the below write operations in MongoDB?

  db.collection.insertMany()
  db.collection.updateMany()
  db.collection.deleteMany()

Check all that apply.

REPLICATION: Question 8

Which of the following are best practice reasons to read from secondaries?

REPLICATION: Question 9

A replica set is under a moderate write load. A new data bearing member with no data is added to an existing replica set. Which of the following might be fetched by the new member before it can become a secondary? Check all that apply.

SHARDING: Question 1

In a sharded cluster, which of the following indexes must contain only unique values? Check all that apply.

SHARDING: Question 2

Your top three queries for a collection consist of the following query patterns:

90% db.employees.find( { lastName : 1, firstName : 1, currentEmployee : 1, company : 1 }, { supervisor : 1, teamName : 1, position: 1, duties : 1, salary : 1 } )
5% db.employees.updateOne( { employeeId: 1 }, { $set : { position : 1, teamName : 1, salary : 1, duties : 1 } } )
1% db.employees.updateOne( { employeeId: 1 }, { $set : { currentEmployee : 1, hireDate: 1 } } )

Your system is outgrowing the servers you currently have it running on, and you’d like to shard the collection. Which of the following shard keys will be most performant?

SHARDING: Question 3

Which of the following are traits of a hashed _id as a shard key, relative to an unhashed _id? Check all that apply.

SHARDING: Question 4

When a chunk is in flight from one shard to another during a migration process, where are reads to that chunk directed?

SHARDING: Question 5

In which of the following situations can we assume sharding will be an effective strategy?

SHARDING: Question 6

Suppose you have a sharded cluster with a status as follows:

mongos> sh.status()
--- Sharding Status --- 
  sharding version: {
        "_id" : 1,
        "version" : 3,
        "minCompatibleVersion" : 3,
        "currentVersion" : 4,
        "clusterId" : ObjectId("51de8630162b88d59cd7b006")
}
  shards:
        {  "_id" : "shard0000",  "host" : "localhost:30000" }
        {  "_id" : "shard0001",  "host" : "localhost:30001" }
        {  "_id" : "shard0002",  "host" : "localhost:30002" }
        {  "_id" : "shard0003",  "host" : "localhost:30003" }
        {  "_id" : "shard0004",  "host" : "localhost:30004" }
        {  "_id" : "shard0005",  "host" : "localhost:30005" }
        {  "_id" : "shard0006",  "host" : "localhost:30006" }
        {  "_id" : "shard0007",  "host" : "localhost:30007" }
  databases:
        {  "_id" : "admin",  "partitioned" : false,  "primary" : "config" }
        {  "_id" : "test",  "partitioned" : true,  "primary" : "shard0001" }
                test.products
                        shard key: { "productId" : 1 }
                        chunks:
                                shard0000        2
                                shard0002        2
                                shard0003        1
                                shard0004        1
                                shard0005        1
                                shard0006        1
                                shard0007        1
                                shard0001        2
                        { "productId" : { "$minKey" : 1 } } -->> { "productId" : 9294 } on : shard0000 { "t" : 2, "i" : 0 } 
                        { "productId" : 9294 } -->> { "productId" : 18684 } on : shard0002 { "t" : 3, "i" : 0 } 
                        { "productId" : 18684 } -->> { "productId" : 27851 } on : shard0003 { "t" : 4, "i" : 0 } 
                        { "productId" : 27851 } -->> { "productId" : 36852 } on : shard0004 { "t" : 5, "i" : 0 } 
                        { "productId" : 36852 } -->> { "productId" : 46047 } on : shard0005 { "t" : 6, "i" : 0 } 
                        { "productId" : 46047 } -->> { "productId" : 55450 } on : shard0006 { "t" : 7, "i" : 0 } 
                        { "productId" : 55450 } -->> { "productId" : 64644 } on : shard0007 { "t" : 8, "i" : 0 } 
                        { "productId" : 64644 } -->> { "productId" : 73769 } on : shard0000 { "t" : 9, "i" : 0 } 
                        { "productId" : 73769 } -->> { "productId" : 82950 } on : shard0002 { "t" : 10, "i" : 0 } 
                        { "productId" : 82950 } -->> { "productId" : 91983 } on : shard0001 { "t" : 10, "i" : 1 } 
                        { "productId" : 91983 } -->> { "productId" : { "$maxKey" : 1 } } on : shard0001 { "t" : 1, "i" : 10 }

Which shards would be involved in answering the following query:

use test;
db.products.find({"productId" : {"$gte" : 20000, "$lte" : 40000}});

Check all that apply.


SHARDING: Question 7

An insufficiently granular (“low cardinality”) shard key can result in which type of problems? Check all that apply.

SHARDING: Question 8

In a sharded collection, which of the following is true of the primary shard?

SHARDING: Question 9

Consider a collection of users with the following fields and possible values:

  • phone_number — a 10-digit telephone number (string)
  • eye_color — “brown”, “hazel”, “blue”, “green”, or “other” (string)
  • weight — an integer in pounds; known for about half the users
  • started_driving_at — the age at which the user got their driver’s license in years. For most users this is 15, 16, 17, or 18. (integer)
  • _id — automatically created on insert (ObjectId)

Assuming the data-access patterns also support your choice, which of these fields would make the best shard key?

SHARDING: Question 10

When should you pre-split data for a sharded cluster? Check all that apply.

SHARDING: Question 11

In the context of a sharded cluster, which of the following is NOT true of chunks?

SHARDING: Question 12

Which of the following are recommended numbers of config servers for a sharded cluster? Check all that apply.

APPLICATION ADMINISTRATION: Question 1

You are required to create a user for your organization that manages all other users.

Which role would be required for this user? Check all that apply.

APPLICATION ADMINISTRATION: Question 2

Which of the following is true about MongoDB’s Role-Based Access Control (RBAC) system?

SERVER ADMINISTRATION: Question 1

What is an indication that your disk speed is causing a performance bottleneck?

SERVER ADMINISTRATION: Question 2

Which of the following must you do before backing up a running sharded cluster using a file system snapshot?

SERVER ADMINISTRATION: Question 3

You have a three-member replica set. If your secondaries are falling behind, which of the following are plausible causes? Check all that apply.

SERVER ADMINISTRATION: Question 4

What are the uses of the mongo shell? Check all that apply.

SERVER ADMINISTRATION: Question 5

In MongoDB, the WiredTiger storage engine provides concurrency at what level?

SERVER ADMINISTRATION: Question 6

Which of the following is not a feature of the WiredTiger storage engine component in MongoDB?

SERVER ADMINISTRATION: Question 7

Which of the following is true of the file system cache when using WiredTiger as your storage engine? Check all that apply.

SERVER ADMINISTRATION: Question 8

Which of the following are compression algorithms available for WiredTiger in MongoDB 4.0? Check all that apply.

SERVER ADMINISTRATION: Question 9

Which of the following are features of zlib compression with WiredTiger? Check all that apply.

SERVER ADMINISTRATION: Question 10

Which of the following commands are correct for exporting data into a CSV file format from a MongoDB server?

mongodump --host localhost:27017 -d catalog -c shoes > shoes.csv

mongoexport --host localhost:27017 -d catalog -c shoes --type=csv -f fields -o shoes.csv

mongoexport --host localhost:27017 -d catalog -c shoes -o shoes.csv


SERVER ADMINISTRATION: Question 11

Which of the following is true regarding the explain() method?

SERVER ADMINISTRATION: Question 12

You would like to store a .gif file in MongoDB using GridFS. Which of the following can help you to do this?

SERVER ADMINISTRATION: Question 13

In MongoDB, which of the following has the option of using the dbpath where your database had put its data files, rather than talking to the mongod process itself?



  • Ask Question