Font size
WorksheetsMongoDB Concepts 2
Total questions: 10
Worksheet time: 5mins
Related to Aggregatio Framework, which of the following are true?
Only one expression per stage can be used.
Some expressions can only be used in specific stages.
When using only one stage, the shorthand syntax db.coll.aggregate({stage}) can be used.
An aggregation pipeline is a list of stages.
Which of the following is true of the $match stage?
It uses the familiar MongoDB query language.
$match can use both query operators and aggregation expressions.
$match can only filter documents on one field.
It should come very early in an aggregation pipeline.
Which of the following statements are true of the $project stage?
Beyond simply removing and retaining fields, $project lets us add new fields.
$project cannot be used to assign new values to existing fields.
$project can only be used once within an Aggregation pipeline.
Once we specify one field to retain, we must specify all fields we want to retain. The _id field is the only exception to this.
What does it mean when we say that MongoDB follows a code-first approach?
It allows you to use third-party frameworks to give you read and write operations.
You can store unstructured data.
There are no complex table definitions, so you can start writing your first data as soon as you connect to your MongoDB database.
You’re ready to work on your database as soon as your table design is created.
MongoDB documents of a similar type are grouped into _______________.
A collection
A cluster
A replica set
An index
Fill in the blank. ___________ provided by MongoDB means as your data needs grow, you can partition your data.
Replication
Aggregation
Projection
Sharding
MongoDB is schema-less. What does that mean?
MongoDB does not require that you create the schema and the table structures before writing the data.
With MongoDB, you alter your tables to store additional fields.
You can only store structured data in MongoDB.
Create the table structures that will hold your data.
Which of the following are comparison operators in MongoDB? (Select all that apply.)
$gte
$lte
$eql
$lt
Jenni works at an e-commerce start-up that uses MongoDB for its customer data management, product catalog and payment processing. Her startup now wants to add personalized recommendations for customers using real-time analytics. Jenni and her team will need to move data to a separate analytics database to handle this new use case.
True
False
You want to create a new membership tier for your bike-sharing service for users who take long trips. Using the trips collection in the sample_training database, you need to find the trips taken by subscribers with the longest trip durations. Return the top 5 results in descending order. To do this, which query should you use? (Select one.)
db.trips.find({ usertype: "Subscriber" }, { sort: { tripduration: -1 } }, { limit: 5 });
db.trips.find({ usertype: "Subscriber" }, { sort: { tripduration: 1 } }, { limit: 5 });
db.trips.find({ usertype: "Subscriber" }).sort({ tripduration: 1 }).limit(5);
db.trips.find({ usertype: "Subscriber" }).sort({ tripduration: -1 }).limit(5);
