MongoDB

MongoDB

Test your MongoDB knowledge with free quizzes on MyCodeSkills covering core concepts.


  1. What is MongoDB?

    • A. A relational database
    • B. A NoSQL document database
    • C. A front-end library
    • D. A programming language
  2. What format does MongoDB use to store documents?

    • A. XML
    • B. CSV
    • C. BSON
    • D. YAML
  3. What is the basic unit of data in MongoDB?

    • A. Table
    • B. Document
    • C. Row
    • D. Column
  4. Which command is used to insert one document?

    • A. insertDocument()
    • B. add()
    • C. insertOne()
    • D. save()
  5. Which MongoDB component stores collections of documents?

    • A. Table
    • B. Row
    • C. Collection
    • D. File
  6. Which operator in MongoDB is used to match values in an array?

    • A. $match
    • B. $in
    • C. $eq
    • D. $array
  7. What does the $gt operator do?

    • A. Finds values greater than a specified value
    • B. Groups documents
    • C. Grants access
    • D. Deletes values
  8. Which of the following is used to validate schema in MongoDB?

    • A. JSON Rules
    • B. Validation Schema
    • C. JSON Schema
    • D. BSON Checker
  9. What’s the main purpose of the $project stage in aggregation?

    • A. Filter documents
    • B. Rename and include fields
    • C. Sort data
    • D. Group records
  10. Which of the following creates a compound index?

    • A. createIndex({name: 1})
    • B. createIndex({name: 1, age: -1})
    • C. createCompoundIndex()
    • D. makeIndex(name, age)
  11. What is the main purpose of replica sets in MongoDB?

    • To manage schema
    • To create indexes
    • To ensure high availability
    • To shard data
  12. Which command initializes a replica set?

    • rs.start()
    • rs.createSet()
    • rs.initiate()
    • rs.begin()
  13. What is a suitable use case for sharding in MongoDB?

    • Low traffic apps
    • Single server environments
    • Small datasets
    • Horizontally scaling large data
  14. What role do config servers play in MongoDB sharding?

    • Store backups
    • Manage schema
    • Track metadata and routing
    • Index data
  15. Which component routes queries in a sharded cluster?

    • Config Server
    • Mongo Shell
    • Mongos
    • Primary Node