Complete the code to insert a document with an embedded address object.
db.users.insertOne({ name: "Alice", address: [1] })The embedded document must be an object with key-value pairs, not an array or string.
Complete the query to find users living in the city 'Springfield'.
db.users.find({ "address.[1]": "Springfield" })To query a nested field, use dot notation with the key name. Here, 'city' is the nested key.
Fix the error in the update query to set the user's street to '456 Elm St'.
db.users.updateOne({ name: "Alice" }, { $set: { "address.[1]": "456 Elm St" } })The street field inside the embedded address document must be updated using 'address.street'.
Fill both blanks to create a document with a nested contact object containing email and phone.
db.contacts.insertOne({ name: "Bob", contact: { [1]: "bob@example.com", [2]: "123-456-7890" } })The nested contact object should have keys 'email' and 'phone' with their respective values.
Fill all three blanks to query documents where the nested 'contact.email' ends with '@example.com'.
db.contacts.find({ "contact.[1]": { [2]: [3] } })To filter by a pattern in a nested field, use dot notation for the field, the $regex operator, and the regex pattern string.