0
0
MongoDBquery~10 mins

Automatic failover behavior in MongoDB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to check the current primary in a MongoDB replica set.

MongoDB
rs.isMaster().[1]
Drag options to blanks, or click blank then click option'
Asecondary
Bprimary
Carbiter
Dhosts
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'secondary' which is a read-only node.
Selecting 'hosts' which lists all nodes but not the primary.
2fill in blank
medium

Complete the command to force a step down of the current primary in MongoDB.

MongoDB
rs.[1](60)
Drag options to blanks, or click blank then click option'
Areconfig
Bfreeze
CstepDown
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'reconfig' which changes replica set config but doesn't step down.
Using 'freeze' which prevents elections but doesn't step down.
3fill in blank
hard

Fix the error in the command to check replica set status.

MongoDB
rs.[1]()
Drag options to blanks, or click blank then click option'
Astatus
Bstat
Cstate
Dinfo
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'stat' which is not a valid command.
Using 'state' or 'info' which do not exist as rs commands.
4fill in blank
hard

Fill both blanks to create a MongoDB query that reads from a secondary node with a max staleness of 90 seconds.

MongoDB
db.getMongo().setReadPref('[1]', [2])
Drag options to blanks, or click blank then click option'
Asecondary
B{ maxStalenessSeconds: 90 }
Cprimary
D{ maxStalenessSeconds: 30 }
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'primary' as read preference which reads only from primary.
Setting maxStalenessSeconds to 30 instead of 90.
5fill in blank
hard

Fill all three blanks to configure a replica set member as an arbiter with priority 0 and votes 1.

MongoDB
{ _id: 2, host: '[1]', arbiterOnly: [2], priority: [3] }
Drag options to blanks, or click blank then click option'
Aarbiter1.example.net:27017
Btrue
C0
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Setting arbiterOnly to false which makes it a normal member.
Giving priority other than 0 for an arbiter.