0
0
MongoDBquery~10 mins

Boolean and null types 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 find documents where the field "active" is true.

MongoDB
db.users.find({"active": [1] })
Drag options to blanks, or click blank then click option'
Atrue
Bnull
Cfalse
D"true"
Attempts:
3 left
💡 Hint
Common Mistakes
Using "true" as a string instead of Boolean true.
Using false or null instead of true.
2fill in blank
medium

Complete the code to find documents where the field "deleted" is false.

MongoDB
db.records.find({"deleted": [1] })
Drag options to blanks, or click blank then click option'
Anull
Bfalse
C"false"
DTrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using "false" as a string.
Using capitalized False or True.
3fill in blank
hard

Fix the error in the query to find documents where "status" is null.

MongoDB
db.orders.find({"status": [1] })
Drag options to blanks, or click blank then click option'
Anull
B"null"
Cundefined
DNone
Attempts:
3 left
💡 Hint
Common Mistakes
Using "null" as a string.
Using undefined or None which cause errors.
4fill in blank
hard

Fill both blanks to find documents where "verified" is true and "deleted" is null.

MongoDB
db.users.find({"verified": [1], "deleted": [2] })
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
Cnull
D"true"
Attempts:
3 left
💡 Hint
Common Mistakes
Using "true" or "null" as strings.
Mixing true and false incorrectly.
5fill in blank
hard

Fill all three blanks to find documents where "active" is false, "deleted" is null, and "confirmed" is true.

MongoDB
db.accounts.find({"active": [1], "deleted": [2], "confirmed": [3] })
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
Cnull
D"false"
Attempts:
3 left
💡 Hint
Common Mistakes
Using quoted strings for Boolean or null.
Mixing true and false values incorrectly.