0
0
MongoDBquery~10 mins

Primary and secondary nodes 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 find the primary node in a MongoDB replica set.

MongoDB
rs.status().members.find(member => member.[1] === 'PRIMARY')
Drag options to blanks, or click blank then click option'
AstateStr
Bname
Chealth
Duptime
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'name' instead of 'stateStr' to identify the primary node.
Confusing 'health' with node role.
2fill in blank
medium

Complete the command to step down the primary node in a MongoDB replica set.

MongoDB
rs.[1]()
Drag options to blanks, or click blank then click option'
AstepDown
Bfreeze
Creconfig
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'reconfig' which changes the replica set configuration.
Using 'freeze' which prevents elections temporarily.
3fill in blank
hard

Fix the error in the command to add a secondary node to the replica set.

MongoDB
rs.add('[1]')
Drag options to blanks, or click blank then click option'
Alocalhost
Blocalhost:27018
C27018
DsecondaryNode
Attempts:
3 left
💡 Hint
Common Mistakes
Providing only hostname without port.
Providing only port number.
4fill in blank
hard

Fill both blanks to create a query that finds all secondary nodes in the replica set.

MongoDB
rs.status().members.filter(member => member.[1] === '[2]')
Drag options to blanks, or click blank then click option'
AstateStr
Bname
CSECONDARY
DPRIMARY
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'name' instead of 'stateStr' for filtering.
Filtering for 'PRIMARY' instead of 'SECONDARY'.
5fill in blank
hard

Fill all three blanks to configure a member as a hidden secondary node in the replica set configuration.

MongoDB
{ _id: [1], host: '[2]', hidden: [3] }
Drag options to blanks, or click blank then click option'
A2
Blocalhost:27019
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Setting 'hidden' to false for a hidden member.
Omitting the port in the host string.