MongoDB Quiz
- What is MongoDB?
Answer: MongoDB is a document-oriented NoSQL database that stores data in flexible, JSON-like documents.
- What are some advantages of using MongoDB over a traditional SQL database?
Answer: Some advantages of MongoDB include its scalability, flexibility, and ability to handle large volumes of unstructured data.
- What is a document in MongoDB?
Answer: A document in MongoDB is a set of key-value pairs, similar to a row in a SQL database.
- What is a collection in MongoDB?
Answer: A collection in MongoDB is a group of related documents.
- What is a database in MongoDB?
Answer: A database in MongoDB is a container for collections.
- What is the syntax for inserting a document into a collection?
Answer: db.collection.insertOne() or db.collection.insertMany()
- What is the syntax for finding documents in a collection?
Answer: db.collection.find()
- What is the syntax for updating a document in a collection?
Answer: db.collection.updateOne() or db.collection.updateMany()
- What is the syntax for deleting a document from a collection?
Answer: db.collection.deleteOne() or db.collection.deleteMany()
- What is indexing in MongoDB?
Answer: Indexing is the process of creating a data structure to improve the speed of data retrieval.
- What is the syntax for creating an index in MongoDB?
Answer: db.collection.createIndex()
- What is sharding in MongoDB?
Answer: Sharding is the process of splitting a large database into smaller, more manageable parts.
- What is the syntax for sharding a MongoDB database?
Answer: sh.enableSharding()
- What is replication in MongoDB?
Answer: Replication is the process of creating multiple copies of data to improve availability and fault tolerance.
- What is the syntax for creating a replica set in MongoDB?
Answer: rs.initiate()
- What is a backup in MongoDB?
Answer: A backup is a copy of a database or collection used for disaster recovery.
- What is the syntax for creating a backup in MongoDB?
Answer: mongodump
- What is a restore in MongoDB?
Answer: A restore is the process of recovering a database or collection from a backup.
- What is the syntax for restoring a backup in MongoDB?
Answer: mongorestore
- What is the syntax for connecting to a MongoDB database from the command line?
Answer: mongo --host hostname --port port_number
- What is a cursor in MongoDB?
Answer: A cursor in MongoDB is a pointer to the result set of a query.
- What is aggregation in MongoDB?
Answer: Aggregation is the process of grouping data and performing operations on those groups.
- What is the syntax for performing aggregation in MongoDB?
Answer: db.collection.aggregate()
- What is the MapReduce function in MongoDB?
Answer: The MapReduce function is a way to process large amounts of data in parallel.
- What is the syntax for using MapReduce in MongoDB?
Answer: db.collection.mapReduce()
Comments
Post a Comment