Complete the code to initialize a Firestore database instance.
const db = firebase.firestore().[1]();The settings() method is used to configure Firestore settings after initialization.
Complete the code to listen for realtime updates in Realtime Database.
database.ref('messages').[1](snapshot => { console.log(snapshot.val()); });
The on() method listens continuously for data changes in Realtime Database.
Fix the error in Firestore query to get documents where age is greater than 18.
db.collection('users').where('age', '[1]', 18).get().then(snapshot => { /* handle data */ });
The where clause uses '>' to filter documents with age greater than 18.
Fill both blanks to write a Firestore query that orders users by name and limits to 5 results.
db.collection('users').[1]('name').[2](5).get();
orderBy('name') sorts the results by name, and limit(5) restricts to 5 documents.
Fill all three blanks to write Realtime Database code that updates user age, sets a listener, and removes a user.
database.ref('users/[1]').[2]({ age: 30 }); database.ref('users').[3](snapshot => { console.log(snapshot.val()); }); database.ref('users/[1]').remove();
We update user 'user123' with update(), listen for changes with on(), and remove the same user.