Notice: Due to an ongoing migration of our storage and publishing system, material requested since last month will not be uploaded for the time being, and new requests are paused. All existing notes remain available.

Unit 4 MCQs Getting Started with MongoDB & Introduction to Mongoose

INT222 — Advanced Web Development 50 questions. Pick an option to check it.

Read the notes

0 of 50 answered 0 right 0 wrong , 50 left

  1. Question 1 of 50

    What type of database is MongoDB classified as?

  2. Question 2 of 50

    In MongoDB, what is the equivalent of a 'Table' in an RDBMS?

  3. Question 3 of 50

    Which format does MongoDB use to store data internally?

  4. Question 4 of 50

    What is the default field added to every MongoDB document to act as a primary key?

  5. Question 5 of 50

    Which command is used in the MongoDB shell to switch to a specific database?

  6. Question 6 of 50

    What happens if you switch to a database that does not exist and insert data?

  7. Question 7 of 50

    Which command displays the list of existing databases in the shell?

  8. Question 8 of 50

    In MongoDB, a 'Row' in an RDBMS is equivalent to a:

  9. Question 9 of 50

    Which command is used to explicitly create a collection with specific options?

  10. Question 10 of 50

    How do you delete a collection named 'users' in the MongoDB shell?

  11. Question 11 of 50

    Which command deletes the currently selected database?

  12. Question 12 of 50

    Which method is used to insert a single document into a collection?

  13. Question 13 of 50

    What is the correct syntax to insert multiple documents at once?

  14. Question 14 of 50

    Which method retrieves all documents from a collection?

  15. Question 15 of 50

    How do you format the output of a find() query to be more readable in the shell?

  16. Question 16 of 50

    Which operator is used to specify fields to include or exclude in a query result (Projection)?

  17. Question 17 of 50

    Which update operator is used to modify the value of a specific field?

  18. Question 18 of 50

    What is the difference between updateOne() and updateMany()?

  19. Question 19 of 50

    Which method is used to remove a document from a collection?

  20. Question 20 of 50

    What is the default TCP port for MongoDB?

  21. Question 21 of 50

    In a MongoDB connection string mongodb://localhost:27017/mydb, what does mydb represent?

  22. Question 22 of 50

    What does ODM stand for in the context of Mongoose?

  23. Question 23 of 50

    Which command installs Mongoose in a Node.js project?

  24. Question 24 of 50

    In Mongoose, what is a 'Schema'?

  25. Question 25 of 50

    Which function is used to create a Mongoose Schema?

  26. Question 26 of 50

    What is a Mongoose 'Model'?

  27. Question 27 of 50

    How do you define a model named 'User' based on a schema userSchema?

  28. Question 28 of 50

    In a Mongoose Schema, how do you ensure a field is mandatory?

  29. Question 29 of 50

    Which method is used to save a new document instance created via Mongoose?

  30. Question 30 of 50

    Which Mongoose method finds a document by its _id?

  31. Question 31 of 50

    What data type should be defined in a Mongoose schema for an age field?

  32. Question 32 of 50

    How do you connect to MongoDB using Mongoose?

  33. Question 33 of 50

    Which query operator is used in MongoDB to find values 'greater than' a specific value?

  34. Question 34 of 50

    What is the purpose of Model.create() in Mongoose?

  35. Question 35 of 50

    When defining a schema, what does default: Date.now do?

  36. Question 36 of 50

    Which Mongoose method is used to find a document by ID and update it?

  37. Question 37 of 50

    In the MongoDB shell, what does db refer to?

  38. Question 38 of 50

    What is the result of db.collection.find({ age: 25 })?

  39. Question 39 of 50

    Which of the following is NOT a valid BSON data type?

  40. Question 40 of 50

    What does the limit() method do in a MongoDB query?

  41. Question 41 of 50

    In Node.js, most MongoDB operations are:

  42. Question 42 of 50

    Which Mongoose schema option adds createdAt and updatedAt fields automatically?

  43. Question 43 of 50

    What is the purpose of the unique: true option in a Mongoose schema field?

  44. Question 44 of 50

    Which method effectively removes a document by ID in Mongoose?

  45. Question 45 of 50

    What is the structural difference between SQL and NoSQL regarding schemas?

  46. Question 46 of 50

    To perform an update that increments a number field by 1, which operator is used?

  47. Question 47 of 50

    What does the findOne method return if no document matches?

  48. Question 48 of 50

    Which file usually contains the database connection logic in a Node/Express app?

  49. Question 49 of 50

    In a Mongoose query, how do you specify that you want to sort the results in descending order?

  50. Question 50 of 50

    If you want to define an array of strings in a Mongoose schema, what is the correct syntax?

That's unit 4

Answer a few questions and your score shows up here.