Complete the code to find all documents where the city is 'Paris'.
db.users.find({"address.[1]": "Paris"})The dot notation accesses the embedded field 'city' inside 'address'. So "address.city" is correct.
Complete the code to update the zipcode to '75001' for users living in 'Paris'.
db.users.updateMany({"address.city": "Paris"}, {$set: {"address.[1]": "75001"}})We use "address.zipcode" to update the zipcode inside the embedded address document.
Fix the error in the query to find users with phone number '123-4567' inside the 'contact' embedded document.
db.users.find({"contact.[1]": "123-4567"})The phone number is stored in the 'phone' field inside the 'contact' embedded document, so use "contact.phone".
Fill both blanks to find users whose address city is 'London' and update their contact email to 'new@example.com'.
db.users.updateMany({"address.[1]": "London"}, {$set: {"contact.[2]": "new@example.com"}})We query by "address.city" and update "contact.email".
Fill all three blanks to create a document with embedded 'profile' containing 'username' and 'age', and insert it into the 'users' collection.
db.users.insertOne({"profile": {"[1]": "alice123", "[2]": [3])The embedded document 'profile' has fields 'username' and 'age'. The age value is a number, so use 30 without quotes.