0
0
Firebasecloud~20 mins

Migrating from Realtime Database to Firestore in Firebase - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Firestore Migration Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Firestore Data Model Differences

When migrating from Realtime Database to Firestore, which of the following best describes a key difference in how data is structured?

AFirestore uses a flat JSON tree, while Realtime Database stores data in tables.
BBoth Firestore and Realtime Database use the same JSON tree structure but with different security rules.
CFirestore stores data in documents and collections, while Realtime Database uses a large JSON tree.
DRealtime Database stores data in documents and collections, while Firestore uses a large JSON tree.
Attempts:
2 left
💡 Hint

Think about how Firestore organizes data compared to Realtime Database.

Architecture
intermediate
2:00remaining
Choosing Firestore Security Rules for Migrated Data

After migrating data from Realtime Database to Firestore, which security rule approach is recommended to maintain similar access control?

AUse Firestore rules that check document fields and user authentication to control access at the document level.
BReuse Realtime Database rules directly in Firestore without changes.
CDisable all Firestore security rules temporarily to avoid access issues.
DUse Firestore rules only at the collection level without checking document fields.
Attempts:
2 left
💡 Hint

Consider how Firestore rules differ from Realtime Database rules in granularity.

Configuration
advanced
2:00remaining
Firestore Query Behavior After Migration

Which Firestore query will correctly retrieve all documents from the 'users' collection where the 'age' field is greater than 25?

const usersRef = firestore.collection('users');
const query = ???;
AusersRef.get('age' > 25)
BusersRef.filter('age', '>', 25)
CusersRef.query('age' > 25)
DusersRef.where('age', '>', 25)
Attempts:
2 left
💡 Hint

Recall the Firestore method to filter documents by field values.

service_behavior
advanced
2:00remaining
Handling Offline Support Differences

After migrating to Firestore, which statement correctly describes offline data behavior compared to Realtime Database?

AFirestore disables offline support by default and requires extra configuration to enable it.
BRealtime Database has built-in offline support, but Firestore does not support offline mode.
CBoth Firestore and Realtime Database require manual caching for offline support.
DFirestore provides built-in offline support with automatic synchronization when online, unlike Realtime Database which requires manual handling.
Attempts:
2 left
💡 Hint

Think about how Firestore manages offline data synchronization.

security
expert
3:00remaining
Preventing Unauthorized Data Access Post-Migration

After migrating to Firestore, you want to ensure users can only read their own profile documents stored in the 'users' collection where document IDs match user IDs. Which Firestore security rule snippet correctly enforces this?

service cloud.firestore {
  match /databases/{database}/documents {
    match /users/{userId} {
      allow read: ???;
    }
  }
}
Arequest.auth.uid == 'admin'
Brequest.auth != null && request.auth.uid == userId
Crequest.auth.uid != null
Dtrue
Attempts:
2 left
💡 Hint

Consider how to match authenticated user ID with document ID.