What command set removes node-1.cluster1.mycompany.local:27017 and node-2.cluster1.mycompany.local:27017 from the replica set, then adds node-1.cluster1.mycompany.local:27017 back to the replica set?
The supported mongosh helpers for replica-set membership changes are rs.remove() and rs.add(). rs.remove(hostname) removes the member whose host string matches the supplied host:port, while rs.add() adds a new member using either a host string or a member configuration document that includes a host field. Option C uses those documented methods in the required sequence: remove node 1, remove node 2, then add node 1 back. The names rs.removeNode() and rs.addNode() shown in the other options are not standard MongoDB replica-set helper methods. Membership changes must be performed carefully because modifying voting or data-bearing membership can affect majority calculations, elections, and availability. Administrators normally execute membership changes while connected to the current primary, allow configuration propagation, and verify replica-set health afterward with rs.status() or related diagnostics. If a removed data-bearing node is later re-added, it may need to synchronize depending on how far its data has diverged from the current replica-set history. Among the choices, option C is the only valid command sequence.
Study Guide reference/topic:Cluster Reliability and Data Resilience - replica-set membership, rs.remove(), rs.add(), and topology changes.
===========
What command lists all indexes for a collection?
db.collection.getIndexes() is the mongosh method used to return the definitions of all indexes that currently exist on a collection. The result is an array of index specification documents that can show fields such as the index name, key pattern, index version, uniqueness, partial-filter settings, sparse configuration, collation, and whether the index is hidden. This makes the method useful for index audits, troubleshooting, and confirming the physical indexes available to the query planner. Option A is not a documented method for enumerating collection indexes. Option B resembles the $indexStats aggregation stage, which reports usage statistics for indexes, but db.collection.indexStats() is not the method used to list full index definitions. Option C, findIndexes(), is also not the documented mongosh collection helper. Administrators should distinguish between listing index definitions, examining index usage, and inspecting an individual query's winning plan: getIndexes() addresses the first requirement, $indexStats addresses usage metrics, and explain() addresses query-planner behavior. Therefore option D is the correct command for listing all indexes on the collection.
Study Guide reference/topic:Indexing and Query Optimization - index administration, index metadata, and db.collection.getIndexes().
===========
You are comparing values of different BSON types in mongodb. You want to compare from lowest to highest. Which comparison order is used?
A department store maintains a clothing collection:
{ "_id": 1, "item": "sweater", "sizes": [ "XS", "S", "L" ] }
{ "_id": 2, "item": "t-shirt", "sizes": [ "S", "M", "L" ] }
{ "_id": 3, "item": "vest", "sizes": [ "M", "L", "XL", "XXL" ] }
An employee runs:
db.clothing.find( { "sizes": "M" } )
Which index should improve performance for this query the MOST?
The query filters only on the sizes field, so the most direct supporting index is a single-field index on sizes. Because sizes contains arrays, MongoDB automatically treats the resulting index as a multikey index and creates index entries derived from the array elements. That allows the query { sizes: 'M' } to locate matching documents through the index rather than scanning every document in the collection. Option B indexes item, which is not part of the predicate and therefore does not help this query. Option C contains sizes, but _id is the leading key and the query provides no equality restriction on _id; this prevents efficient use of the later key as a standalone prefix for the query. Option D has the same structural problem because item precedes sizes and is not constrained. MongoDB's index-prefix rules make a targeted { sizes: 1 } index the strongest choice here. In a real workload, DBAs should also consider write overhead and whether additional queries can share a compound index before creating redundant indexes. For this single query pattern, option A is optimal.
Study Guide reference/topic:Indexing and Query Optimization - multikey indexes, array fields, index prefixes, and query support.
===========
Olivia Miller
1 month agoPaul Green
2 months agoAdam Cook
3 months agoEmily Martin
4 months agoApplication Administration White
5 months agoEmma Hill
5 months agoReplication White
6 months agoSharding Smith
5 months agoCRUD Wilson
3 months agoServer Administration Clark
2 months agoBetty Johnson
6 months agoThomas King
6 months agoJames Baker
6 months agoMonica Phillips
6 months agoMaria Howard
6 months agoDonald Rodriguez
6 months agoJonelle
7 months agoMelina
7 months agoSuzan
7 months agoNichelle
8 months agoJerry
8 months agoThaddeus
8 months agoChantay
8 months agoMicah
9 months agoTrevor
9 months agoReiko
9 months agoAlyce
9 months agoJames
10 months agoAnabel
10 months agoAntione
10 months agoMicaela
10 months agoFrance
11 months agoKris
11 months agoHelene
11 months agoFrederick
11 months agoMargart
12 months agoDorthy
12 months agoKaitlyn
1 year agoNana
1 year agoSherita
1 year agoGilma
1 year agoLouvenia
1 year agoJulianna
1 year agoWerner
1 year agoJamal
1 year agoLemuel
1 year agoArt
1 year agoGlennis
1 year agoSimona
1 year agoDorthy
1 year agoFernanda
1 year agoAndree
1 year agoMa
2 years agoLaura
2 years agoNieves
2 years agoMona
2 years agoTawanna
2 years agoBernadine
2 years agoJaney
2 years agoBernardine
2 years agoDomonique
2 years agoLorita
2 years agoVernell
2 years agoNoemi
2 years agoAlison
2 years agoNickole
2 years agoLaura
2 years agoYasuko
2 years agoThurman
2 years agoZana
2 years agoNickolas
2 years agoLatrice
2 years agoTerrilyn
2 years agoDesirae
2 years agoJeffrey
2 years agoGianna
2 years agoMatthew
2 years agoFreeman
2 years agoToi
2 years agoIesha
2 years agoJesusita
2 years agoAntonio
2 years agoShalon
2 years agoTwanna
2 years agoJenifer
2 years agoEsteban
2 years agoFrederick
2 years ago