firebase

Is it possible to query Field and get main collection field and get sub collection with sub collection documents on cloud firestore?

為{幸葍}努か 提交于 2021-02-20 03:51:22
问题 I need to query fields and get all sub-collections and fields. Is it possible? Stream<List<ChatFieldModel>> getChatField(String uid) { var ref = _db.collection('chats') .where('toUserId', isEqualTo: uid); //Afterthat need to get sub collection with sub collection list of documents and main collection fields value. is it possible? return ref.snapshots().map((list) => list.documents .map((doc) => ChatFieldModel.fromForestore(doc)) .toList()); } 回答1: Firestore queries are shallow. They only

Best Way to Use Business Logic Across Multiple Platforms (Cloud Functions?)

拥有回忆 提交于 2021-02-20 03:50:42
问题 I am in the process of creating a mobile and web version of an app using ReactJS and iOS respectively. Both of these platforms will pull data down from a Firestore database to use but I am wondering what is the best way to only write business logic once in order to do operations on the database? For instance, on both apps you will click a button that updates a field in the Firestore database, instead of writing the logic to do this in Javascript and then Swift, is there a best practice to

Using HttpsCallable with service credentials

你说的曾经没有我的故事 提交于 2021-02-20 02:58:46
问题 I'm using a bunch of HttpsCallable functions that are used by the client to safely invoke things on the backend. I now find myself in a situation where the backend (another cloud function) would need to trigger some of the same operations, so ideally I would just call the HttpsCallable from another cloud function. The callable library is not available in firebase-admin, and I'm assuming that's because it's doing user authentication. Would it be possible to somehow work around this? Maybe I

Using HttpsCallable with service credentials

自古美人都是妖i 提交于 2021-02-20 02:58:09
问题 I'm using a bunch of HttpsCallable functions that are used by the client to safely invoke things on the backend. I now find myself in a situation where the backend (another cloud function) would need to trigger some of the same operations, so ideally I would just call the HttpsCallable from another cloud function. The callable library is not available in firebase-admin, and I'm assuming that's because it's doing user authentication. Would it be possible to somehow work around this? Maybe I

In Firebase Realtime Database Rules, how do you give write access to the users with a certain child value?

ぃ、小莉子 提交于 2021-02-20 00:49:10
问题 ,"people" : { ".read": "auth != null", "$uid": { }, "e2" : { ".read": "auth.uid != null", ".write": "$uid == auth.uid" }, "l1" : { ".read": "auth.uid != null", ".write": "auth.uid != null" } So e2 is the @ of an email. For example @gmail or @aol or @yahoo. For the l1 child, I want to make the write rule: Write if auth.uid != null && e2 has the same value as the e2 of the person you are writing l1 to. The furthest I could get, is something like this: "data.parent().child(people).hasChildren([

Encrypt chat messages stored in Firebase Database

不打扰是莪最后的温柔 提交于 2021-02-19 14:02:53
问题 I am making an application in which chatting is also a feature for which I am using firebase realtime database. Though all the data stored in firebase is via SSL but I want that even the administration is not able to see that messages. I thought of implementing the end-to-end encryption by using the public and private key architecture, but storing the private key on device won't be good as a new private key will be created when the phone is uninstalled or even when the app is used in another

user access and data control to cloud firestore when calls to firestore are made server side

假如想象 提交于 2021-02-19 08:45:38
问题 I've started a web-based project using nodejs, express, firebase functions, firestore and eventually want to use firebase hosting. So far, I have been able to keep everything server side until I've reached Authorisation and Authentication. I'm using a model view controller structure so calls to firestore are being made server side and therefore the firestore security rules don't work. Firestore security rules only work if you access firestore client side. Can I use google cloud IAM (Identity

Use firestore's FieldPath.documentId() in within nested object

眉间皱痕 提交于 2021-02-19 08:03:05
问题 This is how my data is structured: So an element has a cluster object and the cluster object has a tags object with one or more tag objects. This is inline with firebase's denormalized data structure Explained here. (We use multi path updates and lookup tables to keep data consistent, this means tags cant be an array!) I would like to query on the document id's of the nested tags object. I know that firestore.FieldPath.documentId() returns the document id and one can use it in a query like so

Retrieve multiple items in Firestore

左心房为你撑大大i 提交于 2021-02-19 07:43:09
问题 I have the following data structure in Firestore: { items: [ itemId1: {}, itemId2: {}, itemId3: {} ], users: [ userId1: { itemIds: [ "itemId1", "itemId3" ] } ] } The goal of this data structure is for many users to have access to and collaborate on the same items. So moving the items into each user would be rather inefficient and difficult. If I have the userId ( userId1 ), I would like to query the items collection for all items that are within the user's itemIds array. So, in this example,

VueJS Typescript - DOM not updating with variable in Super Class

本秂侑毒 提交于 2021-02-19 07:39:46
问题 Essentially I have a BaseAuthController with on common login functions and variables, I then have a SignupController and a LoginController that inherit from the BaseAuthController. I have looked at the variable through breakpoints and the variables are all being set correctly and they exist. The issue is changing the variable in the super class is not then updating the DOM BaseAuthController.ts import { RouterStates } from './../../../routing/RouterStates'; import Vue from "vue"; export class