google-cloud-firestore

How to Sum nodes in firebase firestore?

血红的双手。 提交于 2021-02-08 10:44:18
问题 I am making app for ordering pizza. Like you see on image i want to take all key values named "ukupno" from each document and Sum it for final price. This is how i fetch cart data: this.cartService.getCart(this.user.Uid).subscribe(res => { this.cart = res.map(i => { return { ...i.payload.doc.data(), id: i.payload.doc.id }; }); }); } getCart(uid) { return this.firestore .collection("cart/") .doc(uid) .collection("/ubaceno") .snapshotChanges(); } 回答1: There are basically two ways to sum up the

Adding Firestore and MultiDex Causes my Android App to Crash

烂漫一生 提交于 2021-02-08 10:43:26
问题 I have been trying to build a simple app with Android Studio which has a Firestore implementation. When I add the following line to my build.gradle file implementation 'com.google.firebase:firebase-firestore:21.3.0' the app does not even build and throws the following error: cannot fit request class in a single dex file I have looked this issue up and found this Stackoverflow page which reccomends adding MultiDex to app. This allows the app to build, but it crashes when I try to run it in the

How to update document in firebase cloud function

こ雲淡風輕ζ 提交于 2021-02-08 10:35:19
问题 In my cloud function I want to update my document from 'dashboard' collection when a new student added to 'students' collection. const getActiveStudents = () => { return db.collection('/students/').where('status', '==', true).get().then( snapshot => { let studentsCount = snapshot.docs.length; db.collection('/dashboard/').where('type', '==', 'students').get().then( result => { if (result.docs.length === 0) { db.collection('dashboard').add({ count: studentsCount, type: 'students', label:

Flutter with firestore missing method

谁都会走 提交于 2021-02-08 10:27:21
问题 MissingPluginException(No implementation found for method DocumentReference#get on channel plugins.flutter.io/cloud_firestore) Hello, i keep having this message for all the methods of firestore with flutter on an android device simulator. I followed the install instruction ("gms...google services" in first gradle and plugin on app gradle file, + the google services.json on app folder. It seems that i should add the firestore api on the android dependencies but this is not on the officiel

Flutter with firestore missing method

给你一囗甜甜゛ 提交于 2021-02-08 10:26:06
问题 MissingPluginException(No implementation found for method DocumentReference#get on channel plugins.flutter.io/cloud_firestore) Hello, i keep having this message for all the methods of firestore with flutter on an android device simulator. I followed the install instruction ("gms...google services" in first gradle and plugin on app gradle file, + the google services.json on app folder. It seems that i should add the firestore api on the android dependencies but this is not on the officiel

iOS Firebase/Firestore Permission Denied

落花浮王杯 提交于 2021-02-08 10:20:30
问题 I know this question has been frequently asked, however the solutions proposed did not solve it for me. I tried to set-up a basic iOS Firestore app which writes some documents inside a collection. I followed the standard procedure, added the GoogleService-Info.plist to my project and I'm calling `FirebaseApp.configure() on launch. My Firestore rules look like this: service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if request.auth !=

Firestore get subcollection parent document ID - JavaScript

浪子不回头ぞ 提交于 2021-02-08 10:20:21
问题 I have the following structure in my Firestore DB: several UserLists collections, which hold the Users . Each user may have a Notes subcollection. I'm doing a subcollection group query that works well, returning notes from across the Notes subcollection. My question is, from the Note document retrieved from the Notes subcollection, can I get the parent document ID? That would be User 1 in the below example. Using JavaScript. Collection: UserList 1 Doc: User 1 Subcollection: Notes Doc: Note 1

iOS Firebase/Firestore Permission Denied

时光怂恿深爱的人放手 提交于 2021-02-08 10:19:33
问题 I know this question has been frequently asked, however the solutions proposed did not solve it for me. I tried to set-up a basic iOS Firestore app which writes some documents inside a collection. I followed the standard procedure, added the GoogleService-Info.plist to my project and I'm calling `FirebaseApp.configure() on launch. My Firestore rules look like this: service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if request.auth !=

Firestore get subcollection parent document ID - JavaScript

落爺英雄遲暮 提交于 2021-02-08 10:19:21
问题 I have the following structure in my Firestore DB: several UserLists collections, which hold the Users . Each user may have a Notes subcollection. I'm doing a subcollection group query that works well, returning notes from across the Notes subcollection. My question is, from the Note document retrieved from the Notes subcollection, can I get the parent document ID? That would be User 1 in the below example. Using JavaScript. Collection: UserList 1 Doc: User 1 Subcollection: Notes Doc: Note 1

Can't fetch firebase collection with React

女生的网名这么多〃 提交于 2021-02-08 10:07:50
问题 I'm using React hooks + firebase. In firebase, I created a collection called "projects" When I try to console log the data with: const Dashboard = () => { const { firebase } = useContext(GlobalContext); return ( <div className="container"> {console.log(firebase.db.collection("projects"))} </div> ); }; I'm getting the following object: Shouldn't be able to see my data? Below are my firebase and context set up firebase.js import app from "firebase/app"; import "firebase/auth"; import "firebase