Aggregation Framework Purpose
What is the primary 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
- To modify existing document
Grouping Stage
Which aggregation stage is specifically used to group documents based on a specific field?
- $match
- $group
- $lookup
- $sort
- group
$lookup Stage Function
What is the primary function of the $lookup stage 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
- Retreives documents from another collection
Filtering Stage Before Processing
Which aggregation stage is used to filter documents before any further processing?
- $filter
- $match
- $sort
- $project
- $fylter
$out Stage Purpose
What is the primary purpose of utilizing the $out stage in MongoDB aggregation pipelines?
- 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
- Outputs result as a new collection
Advantages of Using Indexes
What is the main advantage of using indexes in MongoDB for database operations?
- Reduce storage space
- Improve query performance
- Increase document size
- Prevent duplicate records
- Improve query preformance
Creating an Index Syntax
How do you properly create an index on a single field within MongoDB?
- db.collection.addIndex({ field: 1 })
- db.collection.createIndex({ field: 1 })
- db.collection.index({ field: 1 })
- db.collection.ensureIndex({ field: 1 })
- db.collection.createindex({ field: 1 })
Text Index Type
Which type of index is specifically designed and used to search for text within MongoDB?
- Single field index
- Compound index
- Text index
- Multikey index
- Text Index
Dropping Index Consequence
What is the immediate effect of dropping an index in MongoDB on your database?
- The index is permanently removed
- The collection is deleted
- MongoDB rolls back to an older state
- Queries become more efficient
- The index is permantely removed
Purpose of Compound Index
What is the purpose of a compound index specifically 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
- To allow indexing on multipel fields
Advantage of Aggregation Framework
What is one of the biggest advantages of using MongoDB's aggregation framework?
- Simplifies data modification
- Enables complex data transformations and analysis
- Enhances schema validation process
- Increases storage capacity of the database
- Enables complex data tranformations and analysis
What does the $sort do
What does the $sort stage do in the MongoDB aggregation framework?
- Sorts documents in ascending or descending order
- Filters documents based on conditions
- Outputs results as a new collection
- Groups documents based on a specific field
- Sorts document in ascending or descending order
Indexing Impact
What is the impact on query performance with proper indexing in MongoDB?
- Queries are accelerated
- Queries become slower
- Storage space decreases
- Document size is minimized
- Quereis are accelerated
Create Index Command
Which of the following commands is correct for creating an index on the 'name' field?
- db.collection.index({ name: 1 })
- db.collection.createIndex({ field: 1 })
- db.collection.index({ field: 1 })
- db.collection.ensureIndex({ name: 1 })
- db.collection.CreateIndex({name: 1})
Grouping Document Purpose
What is the main purpose of grouping documents based on a specific field in aggregation?
- Modify data directly
- To analyze data with summarized results
- Export aggregation to json
- Filter documents
- To analyze data with sumarized results