Complete the code to insert a document into the 'users' collection.
db.users.insertOne({ name: "Alice", age: [1] })The age should be a number, so 25 without quotes is correct.
Complete the code to find all documents where the age is greater than 30.
db.users.find({ age: { [1]: 30 } })$lt which means 'less than'.$eq which means 'equal to'.The operator $gt means 'greater than'.
Fix the error in the update command to set the user's city to 'Paris'.
db.users.updateOne({ name: "Bob" }, { [1]: { city: "Paris" } })The correct MongoDB operator to update fields is $set.
Fill both blanks to create a schema design that embeds an address inside a user document.
db.users.insertOne({ name: "Eve", address: { [1]: "123 Main St", [2]: "NY" } })Embedding address fields like street and city inside the user document is a common schema design.
Fill all three blanks to write a query that finds users older than 20 living in 'London'.
db.users.find({ [1]: { [2]: 20 }, address: { [3]: "London" } })The query filters users where age is greater than 20 and city is 'London'.
