MongoDB Certified DBA (C100DBA) exam – Part II

Section 1: Philosophy & Features:

1. Which of the following are valid json documents? Select all that apply.
a. {“name”:”Fred Flintstone”;”occupation”:”Miner”;”wife”:”Wilma”}
b. {}
c. {“city”:”New York”, “population”, 7999034, boros:{“queens”, “manhattan”, “staten island”, “the bronx”, “brooklyn”}}
d. {“a”:1, “b”:{“b”:1, “c”:”foo”, “d”:”bar”, “e”:[1,2,4]}}

Section 2: CRUD Operations:

1. Which of the following operators is used to updated a document partially?
a. $update
b. $set
c. $project
d. $modify

Section 3: Aggregation Framework:

Questions 1 to 3
Below is a sample document of “orders” collection
{
cust_id: “abc123″,
ord_date: ISODate(“2012-11-02T17:04:11.102Z”),
status: ‘A’,
price: 50,
items: [ { sku: "xxx", qty: 25, price: 1 },
{ sku: "yyy", qty: 25, price: 1 } ]
}
Select operators for the below query to determine the sum of “qty” fields associated with the orders for each “cust_id”.
db.orders.aggregate( [
{ $OPR1: "$items" },
{
$OPR2: {
_id: "$cust_id",
qty: { $OPR3: "$items.qty" }
}
}
] )
1. OPR1 is
a. $group
b. $project
c. $unwind
d. $sum
2. OPR2 is
a. $group
b. $sort
c. $limit
d. $sum
3. OPR3 is
a. $match
b. $project
c. $skip
d. $sum

Section 4: Indexing:

1. Which of the following index would be optimum for the query? Select all valid.
db.test.find( { a : 5, c : 2 })
a. db.test.ensureIndex( { a: 1, b :1, c:1, d:1})
b. db.test.ensureIndex( { a : 1, c: 1, d: 1, b : 1})
c. db.test.ensureIndex( { a :1, c:1})
d. db.test.ensureIndex( { c:1, a: 1})

Section 5: Replication:

1. What is the replication factor for a replicated cluster with 1 primary, 3 secondaries with one of them hidden. The set also has an arbiter?
a. 3
b. 4
c. 5
d. None of the above

Section 6: Sharding:

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

Section 7: Server & Application Administration:

1. To add a new user and enable authentication in MongoDB, which of the following steps need be executed?
a. update users collection and restart mongodb
b. update users collection and restart mongodb with –auth option
c. update users collection and run db.enableAuthentication()
d. All of the above

Section 8: Backup & Restore:

1. Which of the following needs to be performed prior to initiate backup on a sharded cluster?
a. db.stopServer()
b. db.stopBalancer()
c. sh.stopServer()
d. sh.stopBalancer()

Answers

Section 1: Philosophy & Features:
1. b,d
Section 2: CRUD Operations
1. b
Section 3: Aggregation Framework
1. c
2. a
3. d
Section 4: Indexing
1. b,c
Section 5: Replication
1. b
Section:6 Sharding
1. sh.enableSharding(“testdb”) & sh.shardCollection(“testdb.testCollection”, {_id : 1 }, true )
Section 7: Server & Application Administration
1. b
Section 8: Backup & Restore
1. d

Nhận xét

Bài đăng phổ biến từ blog này

Trang web medium.com chết, vì sao ?

Cách sử dụng sys.argv trong python.

Thiết kế một RESTful API bằng python và flask.