0
0
MongoDBquery~10 mins

String expressions ($concat, $toUpper, $toLower) 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 concatenate first and last names with a space in between.

MongoDB
{ $concat: ["$firstName", [1], "$lastName"] }
Drag options to blanks, or click blank then click option'
A" "
B"-"
C"_"
D","
Attempts:
3 left
💡 Hint
Common Mistakes
Using a dash or underscore instead of a space
Forgetting to put quotes around the space
2fill in blank
medium

Complete the code to convert the 'city' field to uppercase.

MongoDB
{ $toUpper: "$[1]" }
Drag options to blanks, or click blank then click option'
Acity
BCity
CCITY
DcitY
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase field names
Adding extra spaces inside the field name string
3fill in blank
hard

Fix the error in the code to convert 'country' field to lowercase.

MongoDB
{ $toLower: "$[1]" }
Drag options to blanks, or click blank then click option'
ACountry
Bcountry
CCOUNTRY
DcOUNTRY
Attempts:
3 left
💡 Hint
Common Mistakes
Using uppercase or mixed case field names
Adding spaces inside the field name string
4fill in blank
hard

Fill both blanks to concatenate first name and last name in uppercase with a space in between.

MongoDB
{ $concat: [ { $toUpper: "$firstName" }, [1], { $toUpper: "$lastName" } ] }
Drag options to blanks, or click blank then click option'
A","
B"-"
C"_"
D" "
Attempts:
3 left
💡 Hint
Common Mistakes
Using a dash or underscore instead of a space
Forgetting to put quotes around the space
5fill in blank
hard

Fill all three blanks to concatenate lowercase city and uppercase country with a comma and space in between.

MongoDB
{ $concat: [ { $toLower: "$[1]" }, [2], { $toUpper: "$[3]" } ] }
Drag options to blanks, or click blank then click option'
Acity
B", "
Ccountry
D" - "
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong field names
Using dash instead of comma separator
Forgetting quotes around separator