Complete the code to add a new document to the collection using Firestore's add method.
db.collection('users').[1]({ name: 'Alice', age: 30 });
The add method adds a new document with a generated ID to the collection.
Complete the code to set data for a document with a specific ID using Firestore's set method.
db.collection('users').doc('user123').[1]({ name: 'Bob', age: 25 });
The set method writes data to a document with the specified ID, creating it if it doesn't exist.
Fix the error in the code to correctly add a document with generated ID.
db.collection('orders').doc().[1]({ item: 'Book', quantity: 2 });
When using doc() without arguments, you get a reference to a new document ID. To add data, use set on that document reference.
Fill both blanks to create a new document with a generated ID and set data in one step.
db.collection('products').[1]([2]);
The add method takes an object with data to create a new document with a generated ID.
Fill all three blanks to set data on a document with a specific ID and merge it with existing data.
db.collection('customers').doc([1]).[2]([3], { merge: true });
Use doc('cust123') to specify the document, set to write data, and pass the data object with { merge: true } to merge with existing data.