google-cloud-firestore

getter error while using Geofire to query

為{幸葍}努か 提交于 2020-07-03 12:59:06
问题 I am trying to query database using geoflutterfire. Everything seems to work well but when i query, i get this error: The latitude and longitudes are gotten programmatically from geolocator plugin, yet flutter throws the error below. E/flutter ( 3310): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: NoSuchMethodError: The getter 'latitude' was called on null. E/flutter ( 3310): Receiver: null E/flutter ( 3310): Tried calling: latitude E/flutter ( 3310): #0 Object

Is it possible to have either or whereFields for Firestore query?

别来无恙 提交于 2020-07-03 10:06:07
问题 I want to have a query like db.collection("Bookings") .whereField("servicer", isEqualTo: userID || "customer", isEqualTo: userID) Instead of having two different reads it will just have one, and it gets all the documents that servicer == userID and customer == userID . 回答1: This is not possible with a single query - there is no logical OR operation that works across multiple fields in a document. You will need to have two queries, one for "servicer", and another for "customer", then merge the

Count with Firestore Cloud Functions

∥☆過路亽.° 提交于 2020-07-03 08:15:40
问题 I like to count the number of documents in a subcollection with firestore cloud functions. My database looks like that: groups/{groupId}/members/{memberId} I like to count the number of members (memberId) for each group. That means every group can have a different amount of members, and they can increase or decrease flexible. Would be happy about your ideas :-). 回答1: Took me a while to get this working, so thought I'd share it for others to use: 'use strict'; const functions = require(

Do firebase cloud functions involve costs for realtime db and firestore?

巧了我就是萌 提交于 2020-07-03 03:57:05
问题 I am running a cloud function whenever a firestore document is updated. The function reads the document, gets the user IDs and then takes the user token IDs from the realtime db and sends notification. So we have 1 document read here and some download overhead associated with the reads on the realtime db. My question is : If cloud functions reads a node of the realtime db, will the downloads (for the read on the realtime db) be billable? If cloud functions reads a document of firestore, will

Simple task list ordering - how to save it to Firebase Firestore?

醉酒当歌 提交于 2020-06-29 06:43:10
问题 I'm creating a simple task list web app using firebase firestore and Vue.js. All seem ok until I tried to do the task reordering feature, which turned the project into a nightmare. I can easily implement reorder functionality on the app side by using the Vue Draggable library, that is based on the famous sortable.js library. Basically, I have a v-for code that iterates through my tasks, something like this: <draggable v-model="tasks"> <div v-for="task in tasks" :key="task.id">{{task.title}}<

startAfter not working in Firestore android

情到浓时终转凉″ 提交于 2020-06-29 05:48:26
问题 I created a quiz like app where 10 questions are fetched once. If user got 8 marks out of 10. then I fetch next 10 questions. But startAfter always give the same response. val questionCollectionRef = db.collection("questionCollection") ///.whereArrayContains("tags", tagName) .orderBy("questionID", Query.Direction.DESCENDING); val id = SharedPrefs(this@McqActivity).read(OLD_DOCUMENT_ID, "") if(id.isNotEmpty()){ //questionCollectionRef.whereLessThan("questionID",id) //also tried for

Flutter firebase send Token with database read

倖福魔咒の 提交于 2020-06-29 04:26:13
问题 When I try to read a document in my firebase, I want to be able to check, if the request is legit. For this reason, there is a token that is stored in the firebase. I only want to allow the access, if the token matches with the clients. So my security rules should check, if the token from the client is matching the one in the document. I can not do this with auth, as my App does not have a login and relies purely on the document id and token to access the data. So my question is, how can I

Firestore: Transactions crashing when offline

独自空忆成欢 提交于 2020-06-29 04:13:07
问题 I am aware that according to the changelog (0.12.9+5). It supposedly fixed a crash on android where Transaction s attempted while offline would result in an app crash. However, even with 0.13.7 (the version I'm using). I'm still running into app crashes. There is no error log in the console (just immediate crash). I've tried: Running my app in debug mode on a physical device (same behavior) Attaching error handle callback (not called) Lowering my cloud_firestore version down to 0.12.11 (the

Firebase & React: CollectionReference.doc() argument type

余生颓废 提交于 2020-06-29 04:02:14
问题 I'm trying to figure out how to query a record in firestore using an authUser uid as the document id. I have seen this post and am trying to implement the logic by updating the state of the user so that the componentDidMount function can find a document in the users collection in firestore, where that document has an id which is the same as the authUser.uid in the Authentication collection. I have an authListener with: import React from 'react'; import { AuthUserContext } from '../Session

Alternative for Firestore on GCP

眉间皱痕 提交于 2020-06-29 03:48:14
问题 We recently found a severe limitation of firestore Maximum write rate to a collection in which documents contain sequential values in an indexed field - 500/sec Initially, we didn't see it an issue but once we are into development we hit this road block. Let's consider a simple use-case as an example. Consider a leaderboard for a game where there are 1 Million players. Players will be submitting scores to this leaderboard. At the end of the week/month we want to reward all the participants