MongoDB Interview Questions and Answers
Question - 21 : - What is Aggregation in MongoDB?
Answer - 21 : - In MongoDB, aggregations are operations that process data records and return computed results.
Question - 22 : - Which syntax is used to create a Collection in MongoDB?
Answer - 22 : - We can create a collection in MongoDB using the following syntax:
db.createCollection(name,options)
Question - 23 : - Which syntax is used to drop a Collection in MongoDB?
Answer - 23 : - We can use the following syntax to drop a collection in MongoDB:
db.collection.drop()
Question - 24 : - Explain Replication.
Answer - 24 : - Replication is the process of synchronizing data across multiple servers.
Question - 25 : - What is the use of an Index in MongoDB?
Answer - 25 : - In MongoDB, indexes provide high-performance read operations for frequently used queries.
Question - 26 : - What is the use of GridFS in MongoDB?
Answer - 26 : - GridFS is used for storing and retrieving large files, such as audio, image, and video files.
Question - 27 : - What is the use of Journaling in MongoDB?
Answer - 27 : - Journaling is used for safe backups in MongoDB.
Question - 28 : - Which command is used to see a connection?
Answer - 28 : - We can use the following command to see the connection:
db_adminCommand (“connPoolStats”)
Question - 29 : - Define the primary Replica set.
Answer - 29 : - The primary replica set accepts all write operations from clients.
Question - 30 : - Define the secondary Replica sets.
Answer - 30 : - The secondaries replicate the primary replica set’s oplog and apply the operations to their datasets such that the secondaries’ datasets reflect the primary’s dataset.