MongoDB Quiz

Connect with

Creating a Replica Set

Which command, when issued from the mongo shell, will allow you to read from a secondary?

a) db.isMaster()
b) db.adminCommand({‘readPreference’:’Secondary’})
c) rs.setStatus(“Primary”)
d) rs.slaveOk()

Ans : d

Replica Set Internals

Usually, how long did it take to elect a new primary?

a) About three seconds
b) Above 10 seconds
c) About 30 seconds
d) About a minute
e) Failover and Rollback

Ans: a

Failover and Rollback

What happens if a node comes back up as a secondary after a period of being offline and the oplog has looped on the primary?

Ans: The entire dataset will be copied from the primary

Connecting to a Replica Set from Java

If you leave a replica set node out of the seedlist within the driver, what will happen?

a) The missing node will not be used by the application.
b) The missing node will be discovered as long as you list at least one valid node.
c) This missing node will be used for reads, but not for writes.
d) The missing node will be used for writes, but not for reads.
e) Bad Things Happen to Good Nodes

Ans: b

Bad Things Happen to Good Nodes
If you use the MongoClient constructor that takes a seed list of replica set members, are you guaranteed to avoid application exceptions during a primary failover?

a) Yes
b) No

Ans: No

Introduction to Sharding

If the shard key is not include in a find operation and there are 3 shards, each one a replica set with 3 nodes, how many nodes will see the find operation?

a) 1
b) 3
c) 9
d) 6

Ans: 3

Connect with

Leave a Comment

Your email address will not be published. Required fields are marked *