google-cloud-firestore

How to prevent Firebase Firestore from unnecessary read operations in a Flutter app?

无人久伴 提交于 2020-02-25 04:02:05
问题 So in my Firestore db, I have about 2000 documents that contain images (blob) with some tags to group them, order them and search them on local device. In my app, images are stored in a local SQLFlite db and user is able to see them offline, Firestore offline persistance is also enabled. When device network connection is on, firestore listener reads all my queries again because my app shows my images according to the tags that I use to classify images, even if there is no changes in my

Firestore security rules - can I query for a document with specific fields?

落花浮王杯 提交于 2020-02-24 18:53:41
问题 Can you make security rules that runs a query to check if a matching document is found? I'm building a system where a logged in user can vote on specific topics. Every single vote will be saved in its own document, with a reference to the user, the topic etc. I want to make a security rule that checks if there's already a document in the vote section with that specific user ID and topic ID present, and only let the user write a vote document it that's not the case. I can't see any query

Firestore security rules - can I query for a document with specific fields?

让人想犯罪 __ 提交于 2020-02-24 18:53:33
问题 Can you make security rules that runs a query to check if a matching document is found? I'm building a system where a logged in user can vote on specific topics. Every single vote will be saved in its own document, with a reference to the user, the topic etc. I want to make a security rule that checks if there's already a document in the vote section with that specific user ID and topic ID present, and only let the user write a vote document it that's not the case. I can't see any query

How can I get Timestamp from Firestore server without bothering for the case when device clock is out of sync with Firestore

微笑、不失礼 提交于 2020-02-23 06:26:27
问题 This is in reference to this question Firebase Timestamp difference between current Timestamp and database timestamp error If I use Timestamp.now() there are cases where the device clock is out of sync with Firestore and my time calculations are not accurate. I want to get the exact time from the Firestore server without being bothered by out of sync cases. Is there any way I could do that? I have seen FieldValue.serverTimestamp() but there I cannot find a way to calculate anything using it,

Firestore web code sample gives invalid argument type

若如初见. 提交于 2020-02-21 06:31:27
问题 I am trying out the new Firestore by Firebase. When I run the code sample from https://firebase.google.com/docs/firestore/manage-data/add-data?authuser=0, I am getting an error. // Add a new document with a generated id. db.collection("cities").add({ name: "Tokyo", country: "Japan" }) .then(function(docRef) { console.log("Document written with ID: ", docRef.id); }) .catch(function(error) { console.error("Error adding document: ", error); }); Exception caught: (FirebaseError) : Function

Firestore web code sample gives invalid argument type

痞子三分冷 提交于 2020-02-21 06:31:26
问题 I am trying out the new Firestore by Firebase. When I run the code sample from https://firebase.google.com/docs/firestore/manage-data/add-data?authuser=0, I am getting an error. // Add a new document with a generated id. db.collection("cities").add({ name: "Tokyo", country: "Japan" }) .then(function(docRef) { console.log("Document written with ID: ", docRef.id); }) .catch(function(error) { console.error("Error adding document: ", error); }); Exception caught: (FirebaseError) : Function

Firestore web code sample gives invalid argument type

不问归期 提交于 2020-02-21 06:31:06
问题 I am trying out the new Firestore by Firebase. When I run the code sample from https://firebase.google.com/docs/firestore/manage-data/add-data?authuser=0, I am getting an error. // Add a new document with a generated id. db.collection("cities").add({ name: "Tokyo", country: "Japan" }) .then(function(docRef) { console.log("Document written with ID: ", docRef.id); }) .catch(function(error) { console.error("Error adding document: ", error); }); Exception caught: (FirebaseError) : Function

Firebase Cloud Functions Firestore Trigger produces: Error: 7 PERMISSION_DENIED: Missing or insufficient permissions

别来无恙 提交于 2020-02-20 04:49:59
问题 I'm trying to use a Firebase Cloud Function to update a document within my Firestore database, when one of my documents has been updated using a trigger. The trigger is called and working fine, but when I'm using the firebase admin instance to get the other document which I want to update, I'm getting the following error. Error: 7 PERMISSION_DENIED: Missing or insufficient permissions. at Object.exports.createStatusError (/user_code/node_modules/firebase-admin/node_modules/grpc/src/common.js

Firebase Cloud Functions Firestore Trigger produces: Error: 7 PERMISSION_DENIED: Missing or insufficient permissions

青春壹個敷衍的年華 提交于 2020-02-20 04:49:46
问题 I'm trying to use a Firebase Cloud Function to update a document within my Firestore database, when one of my documents has been updated using a trigger. The trigger is called and working fine, but when I'm using the firebase admin instance to get the other document which I want to update, I'm getting the following error. Error: 7 PERMISSION_DENIED: Missing or insufficient permissions. at Object.exports.createStatusError (/user_code/node_modules/firebase-admin/node_modules/grpc/src/common.js

How to avoid unnecessary Firestore reads with Cache

假如想象 提交于 2020-02-17 07:58:31
问题 I have a list of trips data (Large Sets) ordered by date. Existing Behaviour I store all the trips data into SqlLite Db. For every new data added, I used to get a fcm notification and I synced only the new added data using last updated time concept. This way when ever an cx opens the app, he will always read the data from my DB, Hence saving read and network operations. How could i achieve the same with Firestore? Few problems to consider: Firestore get() always tries to get the data first