Complete the code to initialize Firebase in your app.
import { initializeApp } from 'firebase/app'; const firebaseConfig = { apiKey: "YOUR_API_KEY", authDomain: "YOUR_AUTH_DOMAIN", projectId: "YOUR_PROJECT_ID", storageBucket: "YOUR_STORAGE_BUCKET", messagingSenderId: "YOUR_MESSAGING_SENDER_ID", appId: "YOUR_APP_ID" }; const app = [1](firebaseConfig);
The initializeApp function sets up Firebase with your configuration.
Complete the code to import Firestore from Firebase.
import { [1] } from 'firebase/firestore';
getFirestore is the correct function to import Firestore service.
Fix the error in the code to get Firestore instance.
const db = getFirestore([1]);The getFirestore function requires the Firebase app instance, which is stored in app.
Fill both blanks to add a document to Firestore.
import { collection, [1] } from 'firebase/firestore'; const docRef = await [2](collection(db, 'users'), { name: 'Alice', age: 30 });
addDoc is the correct function to add a new document to a collection.
Fill all three blanks to query Firestore documents with a condition.
import { collection, query, where, getDocs } from 'firebase/firestore'; const q = [1](collection(db, 'users'), [2]('age', [3], 25)); const querySnapshot = await getDocs(q);
Use query to create a query, where to add a condition, and '>' to filter ages greater than 25.
