Complete the code to initialize Firestore in your Firebase project.
const db = firebase.[1]();To use Firestore, you call firebase.firestore() to get the Firestore instance.
Complete the code to add a new document to a Firestore collection named 'users'.
db.collection('users').[1]({ name: 'Alice', age: 30 });
The add method adds a new document with an auto-generated ID to the collection.
Fix the error in the Firestore query to get documents where age is greater than 25.
db.collection('users').where('age', '[1]', 25).get();
The operator '>' is used to filter documents where the field is greater than the given value.
Fill both blanks to update a user's age and merge the data without overwriting the entire document.
db.collection('users').doc('user123').[1]({ age: 31 }, { [2]: true });
Using set with { merge: true } updates fields without replacing the whole document.
Fill all three blanks to migrate a Realtime Database listener to Firestore snapshot listener.
db.collection('users').[1]((snapshot) => { snapshot.docs.forEach(doc => { console.log(doc.[2](), doc.[3]); }); });
data() causes errors.onSnapshot listens for realtime updates. doc.data() gets document data, and doc.id gets the document ID.