VOOZH about

URL: https://www.geeksforgeeks.org/quizzes/mongodb-aggregation-indexing-quiz/

⇱ Quiz about MongoDB Aggregation & Indexing Quiz


Last Updated :
Discuss
Comments

Question 1

What is the purpose of the MongoDB aggregation framework?

  • To modify existing documents

  • To perform complex data transformations and analysis

  • To store multiple collections in a database

  • To enforce schema validation

Question 2

Which aggregation stage is used to group documents based on a specific field?

  •  $match

  • $group

  • $lookup

  • $sort

Question 3

What does the $lookup stage do in MongoDB aggregation?

  •  Retrieves documents from another collection

  • Sorts documents in ascending or descending order

  • Filters documents based on conditions

  • Removes duplicate documents from the result

Question 4

Which aggregation stage is used to filter documents before processing?

  • $filter

  • $match

  • $sort

  •  $project

Question 5

What is the primary purpose of the $out stage in MongoDB aggregation?

  • Outputs results as a new collection

  • Displays results in a formatted way

  • Exports aggregation results to a JSON file


  • Removes specific fields from the output

Question 6

What is the main advantage of using indexes in MongoDB?

  • Reduce storage space

  • Improve query performance


  • Increase document size


  •  Prevent duplicate records


Question 7

How do you create an index on a single field in MongoDB?


  • db.collection.addIndex({ field: 1 })

  • db.collection.createIndex({ field: 1 })

  • db.collection.index({ field: 1 })


  • db.collection.ensureIndex({ field: 1 })


Question 8

Which type of index is used to search text in MongoDB?

  • Single field index

  • Compound index

  • Text index


  • Multikey index


Question 9

What happens when you drop an index in MongoDB?


  •  The index is permanently removed


  • The collection is deleted

  • MongoDB rolls back to an older state


  • Queries become more efficient


Question 10

What is the purpose of a compound index in MongoDB?

  •  To store multiple indexes in one collection

  • To allow indexing on multiple fields


  • To create a separate collection for indexed fields

  • To convert numeric fields into indexed strings


Tags:

There are 10 questions to complete.

Take a part in the ongoing discussion