firestore’s collection link is closed

You might want to store the unique ID of the coupon (maybe its document ID, or maybe a unique identifier generated by some other means) in a document belonging to the user so that you can simply add or remove coupon IDs to that users document.

For example, you might have a structure like users/{user ID} that has a document storing an array of coupon IDs. When a user uses a coupon, it can fetch that coupons information from coupons/{coupon ID} or shops/{shop ID}/coupons/{coupon ID}, then simply remove the coupon ID from the user’s array, thus invalidating their coupon without invalidating the coupon’s data for any other users with the same coupon.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top