google-cloud-firestore

How to optimize Firestore Caching and Querymodeling

允我心安 提交于 2020-03-25 16:53:14
问题 I am making a Moneymanagement-App where the user can create Transfers for each day. I am currently listing all the data on the mainscreen. At the moment that doesn't matter because there isn't much data but imagine a user who uses the app several years and tracking all his spendings. My first thought was to cache all the available Data for that user but that would cause too many unnecessary reads because the user most likely won't need the data from lets say 5 years ago. So I thought the

Expire pending queued items

杀马特。学长 韩版系。学妹 提交于 2020-03-25 13:44:03
问题 I am building a site that users can buy a limited number of event tickets. The users can go on my site and get the tickets. Once they have available tickets in their cart, they will have a set amount of time(5 minutes) to complete the transaction. If they complete the transaction before the timer is up the tickets are permanently removed from the database availability. If they don't complete the transaction before the 5 minutes then their allotment gets put back into the queue for the public

Expire pending queued items

爱⌒轻易说出口 提交于 2020-03-25 13:43:42
问题 I am building a site that users can buy a limited number of event tickets. The users can go on my site and get the tickets. Once they have available tickets in their cart, they will have a set amount of time(5 minutes) to complete the transaction. If they complete the transaction before the timer is up the tickets are permanently removed from the database availability. If they don't complete the transaction before the 5 minutes then their allotment gets put back into the queue for the public

gRPC library is installed but doesn't work

与世无争的帅哥 提交于 2020-03-23 12:31:12
问题 I'm having a error with google Firestore PHP Api, when I try to connect to Firestore the server return me this error: The requested client requires the gRPC extension. Please see https://cloud.google.com/php/grpc for installation instructions . The error comes from vendor/google/cloud/Core/src/ClientTrait.php because the function isGrpLoaded response with a false: /** * Abstract the checking of the grpc extension for unit testing. * * @codeCoverageIgnore * @return bool */ protected function

Firestore billing & USage API

*爱你&永不变心* 提交于 2020-03-23 12:04:16
问题 Does anybody know if Google provides an API to programmatically retrieve the current usage of firestore? More precisely, I'm referring to the current number of read & write operations, as shown here: 回答1: As your screenshot indicates, Firestore provide a Monitor to check the usage of your plan. Unfortunately, though, there is not an API to programmatically return the usage of your Firestore. However, as mentioned in the official documentation Monitoring usage, you can create an alert policy

Flutter - How to save a List<Object> and retrieve using Hive?

╄→гoц情女王★ 提交于 2020-03-23 06:39:12
问题 I have a Wallpaper App and it uses Firestore to store the wallpapers. I want to use Hive to store a list of wallpapers from cloud firestore but how to save the List of Wallpapers and retrieve it later? When I try to save the list I get this error: E/flutter ( 9995): [ERROR:flutter/shell/common/shell.cc(199)] Dart Error: Unhandled exception: E/flutter ( 9995): HiveError: Cannot write, unknown type: Wallpaper. Did you forget to register an adapter? Code: class Wallpaper extends HiveObject {

How to manually add a document to a collection in Firestore database?

纵饮孤独 提交于 2020-03-23 04:46:33
问题 I have a quite simple database in Firestore (geographic name, lat and Lon). The database is very static and I only need to add or remove a record (document) once a while. How can I add a record manually to the collection, with the same fields as the other documents? When I press "Add document" the console asks me to input each field (see screenshot). 回答1: The following HTML page will allow you to write to your spots Firestore collection. You need to adapt the fields, of course, as well as the

Flutter - Can a ListView contain a static widget and a stream

心已入冬 提交于 2020-03-23 03:53:43
问题 Currently my I have a ListView that is warped by a StreamBuilder which gets data from firebase firestore (e.g a list of users). This is how it looks: Widget UsersList = new StreamBuilder( stream: Firestore.instance .collection('users') .snapshots(), builder: (context, snapshot) { if (!snapshot.hasData) return const Text("loading"); return new ListView.builder( itemCount: snapshot.data.documents.length, itemBuilder: (context, index) => _buildItem(context, snapshot.data.documents[index]), ); }

Flutter - Can a ListView contain a static widget and a stream

眉间皱痕 提交于 2020-03-23 03:53:11
问题 Currently my I have a ListView that is warped by a StreamBuilder which gets data from firebase firestore (e.g a list of users). This is how it looks: Widget UsersList = new StreamBuilder( stream: Firestore.instance .collection('users') .snapshots(), builder: (context, snapshot) { if (!snapshot.hasData) return const Text("loading"); return new ListView.builder( itemCount: snapshot.data.documents.length, itemBuilder: (context, index) => _buildItem(context, snapshot.data.documents[index]), ); }

How to abort a Firestore transaction in case of error

我与影子孤独终老i 提交于 2020-03-22 09:57:07
问题 I'm using Firestore runTransaction method in a https Cloud function (running Express). What I want is ensure that if any of the read or write fails the other transaction reads or writes won't run or will rollback if needed. Transaction admin.firestore().runTransaction(async (t) => { const { uid, artworkUid, tagLabel } = req.body; if (!tagLabel) { return Promise.reject('Missing parameters: "tagLabel"'); } if (!artworkUid) { return Promise.reject('Missing parameters: "artworkUid"'); } if