0
0
Firebasecloud~10 mins

Why Realtime Database differs from Firestore in Firebase - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize a Firebase Realtime Database reference.

Firebase
const dbRef = firebase.database().ref([1]);
Drag options to blanks, or click blank then click option'
A'firestore'
B'collections'
C'users'
D'documents'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Firestore terms like 'collections' or 'documents' instead of Realtime Database paths.
2fill in blank
medium

Complete the code to initialize a Firestore collection reference.

Firebase
const colRef = firebase.firestore().collection([1]);
Drag options to blanks, or click blank then click option'
A'database'
B'users'
C'realtime'
D'usersNode'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing Realtime Database paths with Firestore collections.
3fill in blank
hard

Fix the error in the code to listen for realtime updates in Firestore.

Firebase
colRef.onSnapshot([1]);
Drag options to blanks, or click blank then click option'
A(snapshot) => { console.log(snapshot.docs); }
Bfunction() { console.log('update'); }
Con('value', callback)
DaddListener('change', callback)
Attempts:
3 left
💡 Hint
Common Mistakes
Using Realtime Database event listeners like 'on' or 'addListener'.
4fill in blank
hard

Fill both blanks to write a query that gets users older than 18 in Firestore.

Firebase
const query = firebase.firestore().collection('users').where([1], [2], 18);
Drag options to blanks, or click blank then click option'
A'age'
B'name'
C'>'
D'=='
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong field names or operators like '==' instead of '>'.
5fill in blank
hard

Fill all three blanks to write code that updates a user's name in Realtime Database.

Firebase
firebase.database().ref([1]).update({ [2]: [3] });
Drag options to blanks, or click blank then click option'
A'users/user123'
B'name'
C'Alice'
D'age'
Attempts:
3 left
💡 Hint
Common Mistakes
Using Firestore paths or wrong keys like 'age' instead of 'name'.