📖 Scenario: You are working for a company that wants to store and manage large amounts of data that changes quickly. They want to use Google Cloud Platform (GCP) to build a system that can handle this data efficiently.
🎯 Goal: Build a simple GCP NoSQL database setup using Firestore to understand why NoSQL is important on GCP.
📋 What You'll Learn
Create a Firestore database instance
Set a configuration variable for the database mode
Write a query to add data to the Firestore collection
Complete the Firestore setup with proper indexing
💡 Why This Matters
🌍 Real World
NoSQL databases like Firestore on GCP are used to store flexible, fast-changing data such as user profiles, chat messages, or product catalogs.
💼 Career
Understanding how to configure and use NoSQL databases on GCP is essential for cloud engineers and developers building scalable, responsive applications.
Progress0 / 4 steps
1
Create Firestore Database Instance
Create a variable called firestore_instance and set it to the string 'projects/my-project/databases/(default)' to represent the Firestore database instance path.
GCP
Hint
Use a string to represent the Firestore database path exactly as shown.
2
Set Firestore Database Mode Configuration
Create a variable called database_mode and set it to the string 'native' to specify the Firestore database mode.
GCP
Hint
The database mode should be set to 'native' as a string.
3
Add Data to Firestore Collection
Write a line of code that adds a dictionary {'name': 'Alice', 'age': 30} to a Firestore collection called users using a variable called add_user to represent this action.
GCP
Hint
Use a dictionary with keys 'collection' and 'data' to represent adding data to Firestore.
4
Complete Firestore Setup with Indexing
Create a variable called index_config and set it to a dictionary with key 'fields' containing a list with one dictionary that has 'fieldPath' set to 'age' and 'order' set to 'ASCENDING' to represent Firestore indexing configuration.
GCP
Hint
Use a dictionary with a 'fields' key containing a list of dictionaries for indexing.
Practice
(1/5)
1. Why is NoSQL often chosen on Google Cloud Platform (GCP) for certain applications?
easy
A. Because it handles flexible and rapidly changing data well
B. Because it requires complex server management
C. Because it only supports structured data
D. Because it is slower than traditional databases
Solution
Step 1: Understand NoSQL data handling
NoSQL databases are designed to store flexible, semi-structured, or unstructured data that can change quickly.
Step 2: Relate to GCP use case
On GCP, NoSQL services like Firestore and Bigtable support fast-changing data without rigid schemas.
Final Answer:
Because it handles flexible and rapidly changing data well -> Option A
Quick Check:
NoSQL = flexible, fast-changing data [OK]
Hint: NoSQL = flexible data, not rigid tables [OK]
Common Mistakes:
Thinking NoSQL requires complex server management
Assuming NoSQL only supports structured data
Believing NoSQL is slower than SQL
2. Which GCP NoSQL service is best described as a document database?
easy
A. Cloud Spanner
B. Cloud Bigtable
C. Cloud SQL
D. Cloud Firestore
Solution
Step 1: Identify document database on GCP
Cloud Firestore stores data as documents in collections, making it a document database.
Step 2: Differentiate from other services
Cloud Bigtable is a wide-column store, Cloud SQL and Spanner are relational databases.
A. Missing column family 'cf1' creation before setting cell
B. Using wrong row key format
C. Calling commit() before set_cell()
D. Bigtable does not support string values
Solution
Step 1: Check Bigtable column family setup
Bigtable requires column families to exist before writing cells; 'cf1' must be created first.
Step 2: Verify code sequence and data types
Row key format is valid, commit() is correctly called after set_cell(), and Bigtable supports string values.
Final Answer:
Missing column family 'cf1' creation before setting cell -> Option A
Quick Check:
Column family must exist before writing [OK]
Hint: Create column family before writing cells [OK]
Common Mistakes:
Forgetting to create column family
Assuming commit() order is wrong
Thinking Bigtable rejects strings
5. You want to build a scalable app on GCP that needs to store user profiles with flexible fields and also handle millions of fast writes per second. Which combination of NoSQL services should you choose?
hard
A. Use Cloud SQL for profiles and Cloud Spanner for writes
B. Use Cloud Bigtable for profiles and Cloud Firestore for writes
C. Use Cloud Firestore for flexible profiles and Cloud Bigtable for high-speed writes
D. Use Cloud Spanner for both profiles and writes
Solution
Step 1: Match data needs to NoSQL services
Cloud Firestore handles flexible, document-based user profiles well.
Step 2: Match write speed needs
Cloud Bigtable supports massive scale and very fast writes, ideal for high throughput.
Step 3: Evaluate other options
Cloud SQL and Spanner are relational and less suited for flexible schema or extreme write speed.
Final Answer:
Use Cloud Firestore for flexible profiles and Cloud Bigtable for high-speed writes -> Option C
Quick Check:
Firestore + Bigtable = flexible + fast writes [OK]
Hint: Firestore for flexible data, Bigtable for speed [OK]
Common Mistakes:
Choosing relational DBs for flexible schema
Swapping Firestore and Bigtable roles
Ignoring write speed requirements
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.