0
0
MongoDBquery~10 mins

Excluding fields from results 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 exclude the field 'password' from the query results.

MongoDB
db.users.find({}, { [1]: 0 })
Drag options to blanks, or click blank then click option'
Aemail
Bpassword: 1
C_id
Dpassword
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 instead of 0 to exclude fields.
Excluding the wrong field name.
2fill in blank
medium

Complete the code to exclude both 'password' and 'email' fields from the results.

MongoDB
db.users.find({}, { password: 0, [1]: 0 })
Drag options to blanks, or click blank then click option'
Ausername
Bemail
C_id
Dage
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 instead of 0 for exclusion.
Forgetting to add the second field.
3fill in blank
hard

Fix the error in the code to exclude the 'password' field correctly.

MongoDB
db.users.find({}, { [1] })
Drag options to blanks, or click blank then click option'
Apassword: 1
Bpassword
Cpassword: 0
Dpassword: false
Attempts:
3 left
💡 Hint
Common Mistakes
Using 1 instead of 0 to exclude fields.
Using boolean false instead of 0.
4fill in blank
hard

Fill both blanks to exclude 'password' and include only 'username' in the results.

MongoDB
db.users.find({}, { [1]: 0, [2]: 1 })
Drag options to blanks, or click blank then click option'
Apassword
Busername
Cemail
D_id
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to exclude and include fields incorrectly together.
Using wrong field names.
5fill in blank
hard

Fill all three blanks to exclude 'password' and 'email', and include only 'username' in the results.

MongoDB
db.users.find({}, { [1]: 0, [2]: 0, [3]: 1 })
Drag options to blanks, or click blank then click option'
Apassword
Busername
Cemail
D_id
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up which fields to exclude and include.
Using 1 to exclude fields.