google-cloud-firestore

Firebase cloud function idempotency in docs

梦想的初衷 提交于 2021-02-10 20:24:25
问题 I'm following the docs for Firestore here on Aggregation Queries. I couldn't help but notice that the cloud function solution wouldn't exactly work since it's not idempotent: numRatings is incremented and avgRating recomputed each time. Though this example could be made idempotent if there was also a separate document being stored for each new rating: you'd add a check if the user has already submitted a rating for the restaurant. Is there something I'm missing that makes this example

Firebase cloud function idempotency in docs

亡梦爱人 提交于 2021-02-10 20:19:52
问题 I'm following the docs for Firestore here on Aggregation Queries. I couldn't help but notice that the cloud function solution wouldn't exactly work since it's not idempotent: numRatings is incremented and avgRating recomputed each time. Though this example could be made idempotent if there was also a separate document being stored for each new rating: you'd add a check if the user has already submitted a rating for the restaurant. Is there something I'm missing that makes this example

Flutter & Firebase : How to check if my picture is uploaded to Firebase Storage Successfully?

孤者浪人 提交于 2021-02-10 20:09:07
问题 Flutter & Firebase : How to check if my picture is uploaded to Firebase Storage Successfully? I am trying to find a way to see if the picture was upload successful so that I can start and stop my LoadingScreen() . final StorageReference firebaseStorageRef = FirebaseStorage.instance .ref() .child('$path/${userID}_${timeStamp}_${number}_${tag}.jpg'); final StorageUploadTask uploadTask = firebaseStorageRef.putFile(image); I am looking forward to hearing from all of you. Thank you in advance! 回答1

Flutter & Firebase : How to check if my picture is uploaded to Firebase Storage Successfully?

拈花ヽ惹草 提交于 2021-02-10 20:04:27
问题 Flutter & Firebase : How to check if my picture is uploaded to Firebase Storage Successfully? I am trying to find a way to see if the picture was upload successful so that I can start and stop my LoadingScreen() . final StorageReference firebaseStorageRef = FirebaseStorage.instance .ref() .child('$path/${userID}_${timeStamp}_${number}_${tag}.jpg'); final StorageUploadTask uploadTask = firebaseStorageRef.putFile(image); I am looking forward to hearing from all of you. Thank you in advance! 回答1

TypeError: this.path.replace is not a function at new FirestoreDelete

自闭症网瘾萝莉.ら 提交于 2021-02-10 18:27:45
问题 Trying to remove the users`s data calling a function from app. 'use strict'; const functions = require('firebase-functions'); const firebase_tools = require('firebase-tools'); const admin = require('firebase-admin'); const serviceAccount = require('./myapp.json'); admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: "https://myapp.firebaseio.com" }); let db = admin.firestore(); exports.mintAdminToken = functions.https.onCall((data, context) => { const uid =

Property 'firestore' does not exist on type 'FirebaseNamespace' with Firebase v7.15.1

落爺英雄遲暮 提交于 2021-02-10 17:53:37
问题 When I upgrade from firebase v7.14.3 to v7.15.1 I get the following build error / typescript error: TS2339: Property 'firestore' does not exist on type 'FirebaseNamespace'. I import and use Firestore as following: import {firebase} from '@firebase/app'; import '@firebase/firestore'; const firestore: firebase.firestore.Firestore = firebase.firestore(); => firebase.firestore() is my issue. I have probably missed the CHANGELOG, any help on how to migrate this appreciated! 回答1: I have always

Property 'firestore' does not exist on type 'FirebaseNamespace' with Firebase v7.15.1

£可爱£侵袭症+ 提交于 2021-02-10 17:52:26
问题 When I upgrade from firebase v7.14.3 to v7.15.1 I get the following build error / typescript error: TS2339: Property 'firestore' does not exist on type 'FirebaseNamespace'. I import and use Firestore as following: import {firebase} from '@firebase/app'; import '@firebase/firestore'; const firestore: firebase.firestore.Firestore = firebase.firestore(); => firebase.firestore() is my issue. I have probably missed the CHANGELOG, any help on how to migrate this appreciated! 回答1: I have always

Property 'firestore' does not exist on type 'FirebaseNamespace' with Firebase v7.15.1

这一生的挚爱 提交于 2021-02-10 17:51:37
问题 When I upgrade from firebase v7.14.3 to v7.15.1 I get the following build error / typescript error: TS2339: Property 'firestore' does not exist on type 'FirebaseNamespace'. I import and use Firestore as following: import {firebase} from '@firebase/app'; import '@firebase/firestore'; const firestore: firebase.firestore.Firestore = firebase.firestore(); => firebase.firestore() is my issue. I have probably missed the CHANGELOG, any help on how to migrate this appreciated! 回答1: I have always

Array or Subcollection for storing events user uploaded

佐手、 提交于 2021-02-10 16:17:50
问题 I'm creating an events app with react native. I just wanted some advice on which would be the better more performant and scalable way to structure my data model in firestore. I have 2 collections Events and Users. A user creates an event which goes into the Event collection, In my app users can then go onto the main page and view a list of events from the events collection. I also want to have a second page in the app a "users profile" page where users can view a list of their own events,

Returning List from Firestore Listen callback

这一生的挚爱 提交于 2021-02-10 14:39:34
问题 I have a function in firebase that is intended to get all documents in a collection called history and add it to a list intended to be returned. The problem is, and I think this is because .listen() is async, the list returned is always empty. I know the data is queried correctly because I can print the doc in the forEach function, but adding to a list outside doesn't work. By the way, myStream is a snapshot of the history collection in FireStore. Does my function need to be a Future? How can