0
0
MongoDBquery~10 mins

Atlas data federation concept in MongoDB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to specify the data source for Atlas Data Federation.

MongoDB
db.[1].find()
Drag options to blanks, or click blank then click option'
AtempCollection
BlocalCollection
CexternalDB
DfederatedCollection
Attempts:
3 left
💡 Hint
Common Mistakes
Using a local collection name instead of the federated one.
2fill in blank
medium

Complete the code to filter documents where the field 'status' equals 'active' in Atlas Data Federation.

MongoDB
db.federatedCollection.find({ 'status': [1] })
Drag options to blanks, or click blank then click option'
A'active'
Bactive
C"active"
Dactive"
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted strings which are invalid.
3fill in blank
hard

Fix the error in the aggregation pipeline to group documents by 'category' in Atlas Data Federation.

MongoDB
db.federatedCollection.aggregate([ { $group: { _id: [1], count: { $sum: 1 } } } ])
Drag options to blanks, or click blank then click option'
A"$category"
Bcategory
C"category"
D{category}
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the $ prefix, using unquoted field names, or literal strings without $.
4fill in blank
hard

Fill both blanks to project only 'name' and 'email' fields in the Atlas Data Federation query.

MongoDB
db.federatedCollection.find({}, { [1]: 1, [2]: 1 })
Drag options to blanks, or click blank then click option'
Aname
Bemail
Cstatus
Dage
Attempts:
3 left
💡 Hint
Common Mistakes
Including wrong fields or forgetting to set fields to 1.
5fill in blank
hard

Fill all three blanks to sort the federated data by 'createdAt' descending and limit results to 5.

MongoDB
db.federatedCollection.find().sort({ [1]: [2] }).limit([3])
Drag options to blanks, or click blank then click option'
AcreatedAt
B-1
C5
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 instead of -1 for descending or wrong limit number.