Ad
Flutter Firestore Update Documents
I have an App where the user can buy Tickets. And in Firestore the Tickets are represented by documents so each ticket has it's own document. What I want to do is when the user wants to buy 5 Tickets I need a way to pick 5 random documents where the status is available and set them to sold. Is there a specific way to do that?
Ad
Answer
You can retrieve 5 random tickets with a Firestore-query with .limit(5) in a list. After that you can loop to the list and get the id of each ticket and update each ticket to status "sold".
Ad
source: stackoverflow.com
Related Questions
- → How can I query Firebase for an equalTo boolean parameter?
- → How can I access nested data in Firebase with React?
- → Firebase simple blog (confused with security rules)
- → Removing item in Firebase with React, re-render returns item undefined
- → AngularJS Unknown Provider Error (Firebase & AngularFire)
- → How do you pass top level component state down to Routes using react-router?
- → "this" is null in firebase query function in reactjs
- → Angular Module Failed to Load
- → Multiple dex files define Lcom/google/android/gms/internal/zzrx;
- → Joining Firebase tables in React
- → How can I make add firepad to my reactjs project?
- → How to use Cloud Functions for Firebase to prerender pages for SEO?
- → React.js component has null state?
Ad