Complete the code to initialize Firebase in your app.
const app = initializeApp({ apiKey: [1] });You must provide your actual API key as a string to initialize Firebase correctly.
Complete the code to get a Firestore collection reference.
const colRef = collection(db, [1]);The collection name must be a string representing the Firestore collection you want to access.
Fix the error in the Firestore query to get documents where age is greater than 18.
const q = query(colRef, where("age", [1], 18));
The query should use the greater than operator > to filter ages above 18.
Fill both blanks to create a batched write that updates two documents.
const batch = writeBatch(db); batch.[1](doc(db, "users", "user1"), { active: false }); batch.[2](doc(db, "users", "user2"), { active: false }); await batch.commit();
Use update to modify existing documents in a batch write.
Fill all three blanks to create a Firestore security rule that allows read only if user is authenticated and document owner.
allow read: if request.auth != null && request.auth.uid == resource.data.[1] && resource.data.[2] == [3];
The rule checks that the authenticated user's ID matches the document's ownerId and userId fields.