nerdexam
Google

PROFESSIONAL-CLOUD-DEVELOPER · Question #375

You are a developer at an ecommerce company. You are tasked with developing a globally consistent shopping cart for logged-in users across both mobile and desktop clients. You need to configure how th

The correct answer is B. Store the carts in a separate Firestore document, and configure each user ID as the document's. Firestore is a fully managed, globally distributed NoSQL document database with strong consistency guarantees, making it ideal for cross-device, cross-client data that must always reflect the latest state. Using the user ID as the document key provides a simple, secure, and uniqu

Managing application data

Question

You are a developer at an ecommerce company. You are tasked with developing a globally consistent shopping cart for logged-in users across both mobile and desktop clients. You need to configure how the items that are added to users’ carts are stored. How should you configure this cart service?

Options

  • AStore the carts in a separate Memorystore for Redis instance, and configure each user's IP
  • BStore the carts in a separate Firestore document, and configure each user ID as the document's
  • CInsert the carts in a separate Spanner table, and configure each user's encrypted password as
  • DCreate and store the carts in the shopping-cart HTTP cookie.

How the community answered

(44 responses)
  • A
    9% (4)
  • B
    84% (37)
  • C
    2% (1)
  • D
    5% (2)

Explanation

Firestore is a fully managed, globally distributed NoSQL document database with strong consistency guarantees, making it ideal for cross-device, cross-client data that must always reflect the latest state. Using the user ID as the document key provides a simple, secure, and unique lookup. Because Firestore is not tied to any device or session, it works seamlessly across mobile and desktop clients. Option A (Memorystore/Redis) is an in-memory cache, not durable global storage, and using an IP address as a session key breaks cross-device access. Option C (Spanner with encrypted password as key) is a security anti-pattern - passwords should never be used as data keys. Option D (HTTP cookie) is client-side only and cannot be shared across different devices or platforms.

Topics

#Firestore#Database Selection#Application Architecture#Global Consistency

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVELOPER Practice