0
0
Firebasecloud~5 mins

Document ID strategies in Firebase - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a Document ID in Firebase Firestore?
A Document ID is a unique identifier for each document in a Firestore collection. It helps to find, update, or delete that specific document.
Click to reveal answer
beginner
What are the two main ways to create Document IDs in Firestore?
You can either let Firestore auto-generate a random unique ID or create your own custom ID based on your app's needs.
Click to reveal answer
intermediate
Why might you choose to use custom Document IDs instead of auto-generated ones?
Custom IDs can make documents easier to find and organize if they follow a meaningful pattern, like user emails or product codes.
Click to reveal answer
intermediate
What is a risk of using predictable Document IDs?
Predictable IDs can lead to security risks if unauthorized users guess IDs and access data they shouldn’t see.
Click to reveal answer
advanced
How does Firestore generate auto IDs?
Firestore creates a 20-character string with random letters and numbers to ensure uniqueness and avoid collisions.
Click to reveal answer
What does Firestore use as a Document ID if you don't specify one?
AA random unique string
BThe current timestamp
CThe user's email address
DA sequential number
Which of these is a benefit of using custom Document IDs?
APrevents data loss
BEasier to remember and organize documents
CFaster database queries
DAutomatically more secure
What is a potential downside of using predictable Document IDs?
AThey slow down the database
BThey take more storage space
CThey can be guessed by unauthorized users
DThey cause data duplication
How long is a Firestore auto-generated Document ID?
A20 characters
B10 characters
C32 characters
D8 characters
Which strategy is best when you need to reference documents by a known key like a username?
AUse auto-generated Document IDs
BUse random numbers as Document IDs
CUse timestamps as Document IDs
DUse custom Document IDs
Explain the difference between auto-generated and custom Document IDs in Firestore.
Think about how Firestore creates IDs and why you might want to choose your own.
You got /4 concepts.
    Describe a scenario where using custom Document IDs might cause security concerns.
    Consider what happens if someone guesses a document's ID.
    You got /4 concepts.