When migrating from Realtime Database to Firestore, which of the following best describes a key difference in how data is structured?
Think about how Firestore organizes data compared to Realtime Database.
Firestore organizes data into documents and collections, which allows for more structured and scalable data storage. Realtime Database uses a single large JSON tree.
After migrating data from Realtime Database to Firestore, which security rule approach is recommended to maintain similar access control?
Consider how Firestore rules differ from Realtime Database rules in granularity.
Firestore security rules operate at the document level and can check fields and authentication to control access precisely. Realtime Database rules cannot be reused directly.
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 = ???;Recall the Firestore method to filter documents by field values.
Firestore uses the where method to filter documents by field values. Other methods like filter or query do not exist.
After migrating to Firestore, which statement correctly describes offline data behavior compared to Realtime Database?
Think about how Firestore manages offline data synchronization.
Firestore disables offline support by default (on web SDK) and requires extra configuration such as enablePersistence() to enable it, while Realtime Database has built-in offline support automatically.
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: ???;
}
}
}Consider how to match authenticated user ID with document ID.
The rule allows read only if the user is authenticated and their UID matches the document ID, preventing access to other users' data.