0
0
MongoDBquery~10 mins

deleteOne method 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 delete one document where the name is 'Alice'.

MongoDB
db.collection('users').deleteOne({ name: [1] })
Drag options to blanks, or click blank then click option'
A'Alice'
BAlice
C"name"
D'name'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting quotes around string values
Using the field name as the value instead of the actual value
2fill in blank
medium

Complete the code to delete one document where the age is 30.

MongoDB
db.collection('users').deleteOne({ age: [1] })
Drag options to blanks, or click blank then click option'
A'30'
B'age'
C"age"
D30
Attempts:
3 left
💡 Hint
Common Mistakes
Putting numbers inside quotes, making them strings
Using the field name as the value
3fill in blank
hard

Fix the error in the code to delete one document where the status is 'active'.

MongoDB
db.collection('users').deleteOne({ status: [1] })
Drag options to blanks, or click blank then click option'
A'active'
Bactive
C"status"
Dstatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using unquoted strings causing reference errors
Confusing field names with values
4fill in blank
hard

Fill both blanks to delete one document where the city is 'Paris' and the age is 25.

MongoDB
db.collection('users').deleteOne({ [1]: [2], age: 25 })
Drag options to blanks, or click blank then click option'
Acity
B'Paris'
C'city'
DParis
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes around keys incorrectly
Not quoting string values
5fill in blank
hard

Fill all three blanks to delete one document where the first name is 'John', last name is 'Doe', and active status is true.

MongoDB
db.collection('users').deleteOne({ firstName: [1], lastName: [2], active: [3] })
Drag options to blanks, or click blank then click option'
A'John'
B'Doe'
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around boolean values
Forgetting quotes around string values