81. Which command creates a MongoDB Atlas Search index?
- a) db.collection.createSearchIndex({...})
- b) db.createAtlasIndex()
- c) db.collection.makeSearchIndex()
- d) db.searchIndex()
createSearchIndex() and support full-text search features.
Test your knowledge of Database - [MongoDB] section with these interactive multiple-choice questions.
81. Which command creates a MongoDB Atlas Search index?
createSearchIndex() and support full-text search features.
82. What is the purpose of the $search aggregation stage?
$search leverages Atlas Search indexes for advanced text search capabilities.
83. Which operator performs graph traversal in MongoDB?
$graphLookup performs recursive searches on document relationships.
84. What does the $collStats aggregation stage return?
$collStats provides storage metrics, index details, and sharding information.
85. Which method safely shuts down a mongod instance?
db.shutdownServer() performs a clean shutdown when connected to admin database.
86. What is the purpose of the $planCacheStats operator?
$planCacheStats reveals how query shapes are cached for optimization.
87. Which command creates a MongoDB view?
88. What does the $indexStats aggregation stage return?
$indexStats shows how often each index is used for queries.
89. Which operator implements Redact in aggregation?
$redact controls document field visibility based on conditional logic.
90. What is the purpose of the $sample stage?
{ $sample: { size: 10 } } returns a random document subset.
91. Which method returns MongoDB server status?
serverStatus() provides instance metrics like connections, memory, and operations.
92. What does the $mergeObjects operator do?
{ $mergeObjects: [doc1, doc2] } creates a union of fields (last document wins conflicts).
93. Which command lists all MongoDB users?
db.listUsers() displays all users for the current database.
94. What is the purpose of the $switch operator?
$switch works like a switch/case statement in aggregation pipelines.
95. Which operator validates BSON types?
{ field: { $type: "string" } } matches documents with specific BSON types.
96. What does the $dateFromString operator do?
{ $dateFromString: { dateString: "$dateStr" } } parses strings into Date objects.
97. Which method exports MongoDB data to JSON?
mongoexport CLI tool exports collections to JSON or CSV.
98. What is the purpose of the $concatArrays operator?
{ $concatArrays: [array1, array2] } creates a new combined array.
99. Which command enables MongoDB auditing?
--auditDestination flag (file/syslog/console).
100. What does the $isoWeek operator return?
{ $isoWeek: "$date" } extracts the ISO 8601 week number from a date.