12 Sep 100 MongoDB MCQ (Multiple Choice Questions) with Answers
Show Answer
2) In MongoDB, data is stored in which format?
Show Answer
3) What is the equivalent of a table in MongoDB?
Show Answer
4) What is the equivalent of a row in MongoDB?
Show Answer
5) What is the primary unique identifier field automatically added to every MongoDB document if not provided?
Show Answer
6) What is the default data type of the `_id` field?
Show Answer
7) How many bytes does an ObjectId occupy?
Show Answer
8) Which command starts the MongoDB server process?
Show Answer
9) Which process acts as a routing service for MongoDB sharded clusters?
Show Answer
10) What is the maximum size of a BSON document in MongoDB?
Show Answer
11) Which command displays the list of all databases?
Show Answer
12) Which command switches to a specific database named `testDB`?
Show Answer
13) How do you check which database is currently selected?
Show Answer
14) Which command is used to drop the current database?
Show Answer
15) Which method explicitly creates a collection in MongoDB?
Show Answer
16) Which command lists all collections in the current database?
Show Answer
17) How do you drop a collection named `users`?
Show Answer
18) What happens when you insert a document into a collection that does not exist?
Show Answer
19) What is a capped collection?
Show Answer
20) Which parameter creates a capped collection using `db.createCollection()`?
Show Answer
21) Which method inserts a single document into a collection?
Show Answer
22) Which method inserts multiple documents at once?
Show Answer
23) If `ordered: false` is passed in `insertMany()`, what happens if one document fails?
Show Answer
24) What happens if you specify an existing `_id` during an insert operation?
Show Answer
25) Which method updates a document if found, or inserts it if it doesn’t exist (when `upsert: true`)?
Show Answer
26) Which method is used to query documents from a collection?
Show Answer
27) How do you return only one matching document from a collection?
Show Answer
28) What does `db.collection.find()` return if no query parameters are given?
Show Answer
29) How do you format output to make it readable in the MongoDB shell?
Show Answer
30) Which projection syntax includes only the `name` field in query results?
Show Answer
31) By default, is the `_id` field included in projection results?
Show Answer
32) How do you limit the output of a query to 5 records?
Show Answer
33) Which method skips the first 10 documents in a result set?
Show Answer
34) How do you sort results by `age` in ascending order?
Show Answer
35) How do you sort results by `age` in descending order?
Show Answer
36) Which operator checks for equality?
Show Answer
37) Which operator selects documents where a field value is greater than a specified value?
Show Answer
38) Which operator selects documents where a value is less than or equal to a specified value?
Show Answer
39) Which operator matches any of the values specified in an array?
Show Answer
40) What is the opposite operator of `$in`?
Show Answer
41) Which logical operator returns documents that satisfy ALL given conditions?
Show Answer
42) Which logical operator matches documents where NEITHER condition is true?
Show Answer
43) Which operator checks for the existence of a field in a document?
Show Answer
44) Which operator selects documents based on BSON data types?
Show Answer
45) Which operator allows regex searching in MongoDB queries?
Show Answer
46) Which operator matches arrays containing ALL specified elements?
Show Answer
47) Which operator checks the exact array size in a document?
Show Answer
48) Which operator matches documents containing an array field with at least one element matching all criteria?
Show Answer
49) How do you select documents where `age` is between 20 and 30 inclusive?
Show Answer
50) What operator evaluates a JavaScript expression inside a query?
Show Answer
51) Which operator sets the value of a field in a document?
Show Answer
52) Which operator deletes a specified field from a document?
Show Answer
53) Which operator increments a field value by a specified number?
Show Answer
54) How do you decrement a numeric field `points` by 5?
Show Answer
55) Which array operator appends a single item to an array field?
Show Answer
56) Which array operator appends items to an array ONLY if they do not already exist?
Show Answer
57) Which operator removes the first or last item from an array?
Show Answer
58) How do you remove all instances of a specific value from an array?
Show Answer
59) Which method deletes a single matching document from a collection?
Show Answer
60) Which method deletes ALL documents matching a query?
Show Answer
61) What does `db.collection.deleteMany({})` do?
Show Answer
62) Which method replaces an entire single document except the `_id` field?
Show Answer
63) What is the primary benefit of creating indexes in MongoDB?
Show Answer
64) Which method creates an index on a collection?
Show Answer
65) How do you create an ascending index on the `email` field?
Show Answer
66) What is a compound index?
Show Answer
67) Which index type enforces uniqueness for indexed field values?
Show Answer
68) How do you create a unique index on `username`?
Show Answer
69) What type of index automatically deletes documents after a specified time period?
Show Answer
70) Which index type indexes array data by creating entries for each array element?
Show Answer
71) How do you list all indexes on a collection named `orders`?
Show Answer
72) How do you drop an index on field `email`?
Show Answer
73) What tool/method shows query performance statistics, such as index usage?
Show Answer
74) What is a “covered query”?
Show Answer
75) What default index is created on every collection automatically?
Show Answer
76) Which method is used to process data through an aggregation pipeline?
Show Answer
77) In aggregation, which stage filters documents (similar to `find()`)?
Show Answer
78) Which aggregation stage groups documents by a specified key?
Show Answer
79) What field is required inside the `$group` stage to define group keys?
Show Answer
80) Which aggregation stage reshapes documents by including, excluding, or adding fields?
Show Answer
81) Which aggregation stage is used to sort incoming documents?
Show Answer
82) Which aggregation stage flattens an array field to output a document for each element?
Show Answer
83) Which aggregation stage performs a left outer join to another collection?
Show Answer
84) Which parameter in `$lookup` specifies the collection in the same database to join?
Show Answer
85) Which aggregation stage outputs results directly into a specified collection?
Show Answer
86) Which accumulator operator counts the number of documents in a `$group` stage?
Show Answer
87) Which operator calculates the average of numeric values in a group?
Show Answer
88) Which aggregation stage restricts the number of documents passed to the next stage?
Show Answer
89) What is a Replica Set in MongoDB?
Show Answer
90) How many Primary nodes can a single Replica Set have at any given time?
Show Answer
91) What happens if the Primary node fails in a Replica Set?
Show Answer
92) What is the role of an Arbiter in a Replica Set?
Show Answer
93) What is Sharding in MongoDB?
Show Answer
94) What component acts as a query router for a sharded cluster?
Show Answer
95) What is a Shard Key?
Show Answer
96) What component stores metadata and configuration settings for a sharded cluster?
Show Answer
97) Which command enables sharding on a specific database?
Show Answer
98) What is the default write concern level in MongoDB?
Show Answer
99) Which authentication mechanism is enabled by default in secured MongoDB setups?
Show Answer
100) Which MongoDB utility is used to export data into BSON binary dumps for backup?
Show Answer
No Comments