161. Which command configures a MongoDB Atlas Search analyzer?
- a) Atlas UI/API only
- b) db.createAnalyzer()
- c) mongod --analyzer
- d) db.analyzer.setup()
Test your knowledge of Database - [MongoDB] section with these interactive multiple-choice questions.
161. Which command configures a MongoDB Atlas Search analyzer?
162. What is the purpose of the $dayOfWeek operator?
{ $dayOfWeek: "$date" } extracts the ISO day of week (1-7).
163. Which method enables MongoDB's SNMP monitoring?
net.snmp settings in mongod.conf or --snmp command-line option.
164. What does the $isoDayOfWeek operator return?
{ $isoDayOfWeek: "$date" } follows ISO 8601 (Monday=1 to Sunday=7).
165. Which operator performs case-sensitive string comparison?
$cmp performs case-sensitive comparison, while $strcasecmp is case-insensitive.
166. What is the purpose of the $count stage?
{ $count: "total" } adds a field with the pipeline's document count.
167. Which command lists all MongoDB's current locks?
currentOp(true) shows operations with their lock details.
168. What does the $substrCP operator do?
{ $substrCP: ["MongoDB", 0, 3] } returns "Mon" (handles multi-byte chars correctly).
169. Which method returns MongoDB's query executor stats?
serverStatus() output.
170. What is the purpose of the $dateFromString operator with timezone?
{ $dateFromString: { dateString: "text", timezone: "America/New_York" } }.
171. Which operator checks if a field is missing or null?
$exists and null checks (no single operator).
172. What does the $strLenCP operator return?
{ $strLenCP: "MongoDB" } returns 7 (counts Unicode chars, not bytes).
173. Which command lists all Atlas Search indexes?
getSearchIndexes() returns Atlas Search index configurations.
174. What is the purpose of the $toLower operator?
{ $toLower: "MongoDB" } returns "mongodb".
175. Which operator checks if arrays have same elements?
{ $setEquals: [array1, array2] } ignores element order.
176. What does the $abs operator do?
{ $abs: -5 } returns 5.
177. Which method returns MongoDB's storage engine stats?
serverStatus().
178. What is the purpose of the $toString operator?
{ $toString: 42 } returns "42".
179. Which operator checks if value is a number?
{ $type: ["$field", "number"] } or check specific numeric types.
180. What does the $toInt operator do?
{ $toInt: "42" } returns 42 (errors on non-numeric strings).