0
0
MongoDBquery~10 mins

Document model mental model (JSON/BSON) 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 create a MongoDB document with a name field.

MongoDB
{ "name": "[1]" }
Drag options to blanks, or click blank then click option'
Atrue
BAlice
Cnull
D123
Attempts:
3 left
💡 Hint
Common Mistakes
Using a number or boolean instead of a string for the name field.
2fill in blank
medium

Complete the code to add an age field with a number value.

MongoDB
{ "age": [1] }
Drag options to blanks, or click blank then click option'
A"twenty"
Btrue
C30
D"30"
Attempts:
3 left
💡 Hint
Common Mistakes
Putting the number inside quotes, making it a string instead of a number.
3fill in blank
hard

Fix the error in the document by choosing the correct boolean value for the active field.

MongoDB
{ "active": [1] }
Drag options to blanks, or click blank then click option'
ATrue
B"true"
C1
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using quotes around true or capitalizing it, which is invalid in JSON.
4fill in blank
hard

Fill both blanks to create a nested document with address and city fields.

MongoDB
{ "address": { "city": "[1]", "zip": [2] } }
Drag options to blanks, or click blank then click option'
ANew York
B10001
C"Los Angeles"
D90210
Attempts:
3 left
💡 Hint
Common Mistakes
Putting quotes inside quotes for city or using zip code as a string.
5fill in blank
hard

Fill all three blanks to create a document with a list of tags and a flag.

MongoDB
{ "tags": [[1], [2]], "flag": [3] }
Drag options to blanks, or click blank then click option'
A"mongodb"
B"database"
Cfalse
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using booleans as strings or forgetting quotes around strings in the list.