0
0
MongoDBquery~10 mins

What is MongoDB - Interactive Quiz & Practice

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

Complete the code to find all documents in the collection.

MongoDB
db.collection.[1]()
Drag options to blanks, or click blank then click option'
Ainsert
Bfind
Cupdate
Ddelete
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'insert' instead of 'find' to get data.
Using 'update' or 'delete' which change or remove data.
2fill in blank
medium

Complete the code to insert a new document into the collection.

MongoDB
db.collection.[1]({ name: 'Alice', age: 25 })
Drag options to blanks, or click blank then click option'
AinsertOne
Bfind
CdeleteOne
DupdateOne
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'find' which only reads data.
Using 'deleteOne' or 'updateOne' which remove or change data.
3fill in blank
hard

Fix the error in the code to update a document's age.

MongoDB
db.collection.updateOne({ name: 'Alice' }, { [1]: { age: 26 } })
Drag options to blanks, or click blank then click option'
A$set
B$get
C$add
D$remove
Attempts:
3 left
💡 Hint
Common Mistakes
Using '$get' which is not a valid update operator.
Using '$add' or '$remove' which do not update fields.
4fill in blank
hard

Fill both blanks to delete a document where age is 30.

MongoDB
db.collection.[1]([2]: 30)
Drag options to blanks, or click blank then click option'
AdeleteOne
Bage
Cname
Dremove
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'remove' which is deprecated.
Using 'name' instead of 'age' in the filter.
5fill in blank
hard

Fill all three blanks to find documents where age is greater than 20.

MongoDB
db.collection.find({ [1]: { [2]: [3] } })
Drag options to blanks, or click blank then click option'
Aage
B$gt
C20
D$lt
Attempts:
3 left
💡 Hint
Common Mistakes
Using '$lt' which means less than.
Using wrong field names or values.