google-cloud-firestore

Flutter / FireStore: how to display an image from Firestore in Flutter?

 ̄綄美尐妖づ 提交于 2020-08-03 03:38:30
问题 I want to put some images that I use in my app to Firestore, and display them from there, rather than having them as assets, bundled in my app. In order to do this, I came up with the following solution: for the item I want to display an image, I created a Firebase document, where I have a field that stores the name of the file that stores the corresponding picture: document - name - description - imageName Then, I uploaded an image to FireStore with the same name. When I want to display the

Realm syncing with large collection on Firestore - architectural questions / issues

隐身守侯 提交于 2020-08-02 05:29:45
问题 I have a collection of product objects (title, desc, price, quant, urlString, etc) in a Firestore collection. Currently around 1000 items, but that could go to 10k. On my iOS app launch, I setup a collection listener ( db.collection("products").rx.listen() ) which then saves changes to a local Realm database. .subscribe(onNext: { querySnapshot in querySnapshot.documentChanges.forEach { docChange in autoreleasepool { let realm = try! Realm(configuration: Realm.Configuration

How to delete object from array in firestore

生来就可爱ヽ(ⅴ<●) 提交于 2020-08-01 10:45:18
问题 I have a problem with deleting an Object out of an Array in firestore . I have this data in firestore: And now I would like to delete e.g the second Object out of the posts Array . Code: deletePic () { let docId = `${this.currentUser.uid}` fb.usersCollection.doc(docId).update({ posts: firebase.firestore.FieldValue.arrayRemove() }) .catch(function(error) { console.error("Error removing document: ", error); }); } But I do not know how to define arrayRemove() These are the pictures and each one

Execution failed for task ':app:mergeDexDebug'. Firestore | Flutter

柔情痞子 提交于 2020-08-01 03:20:12
问题 Trying to use Firestore in my project. My project is a brand new one, but having problems running the app on my device without getting an error: Execution failed for task ':app:mergeDexDebug'. My app is using AndroidX. I've added my google-services.json file, followed the steps etc. Yaml file: dependencies: cloud_firestore: ^0.13.3 android/build.gradle: com.google.gms:google-services:4.3.3 Full error: FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':app

How to add document Id in the document in firestore database in flutter application

坚强是说给别人听的谎言 提交于 2020-07-31 06:10:48
问题 I am using below code to add document in firestore collection in a flutter application. I am not getting an idea that on how to add the document id in the document. Please guide me Firestore.instance.collection("posts1").add({ //"id": "currentUser.user.uid", "postTitle": posttitle.text, "postcategory": selectedCategory, "post_id":documentId, }) .then((result) => {print("success")} 回答1: Use document() with no arguments to first generate a reference to a document with a random ID, then use

How to add document Id in the document in firestore database in flutter application

你离开我真会死。 提交于 2020-07-31 06:03:03
问题 I am using below code to add document in firestore collection in a flutter application. I am not getting an idea that on how to add the document id in the document. Please guide me Firestore.instance.collection("posts1").add({ //"id": "currentUser.user.uid", "postTitle": posttitle.text, "postcategory": selectedCategory, "post_id":documentId, }) .then((result) => {print("success")} 回答1: Use document() with no arguments to first generate a reference to a document with a random ID, then use

How can I set Rules in Firebase so that only my app can write on my database firestore?

旧城冷巷雨未停 提交于 2020-07-31 05:06:45
问题 Firebase told me that my Database is not secure because I had as rules: service cloud.firestore { match /databases/{database}/documents { match /mypath/{document=**} { allow write: if true; allow read, delete: if false; } } } I do not have problem about read and delete since only my server that use FirebaseAdmin can do such operations. However I still have a problem regarding write operations. This is the reason why I switch to this configuration: service cloud.firestore { match /databases/

Query data in multiple collections

一笑奈何 提交于 2020-07-31 04:37:29
问题 I am developing a chat app using Firebase Firestore. I have a collection for room chat and another one for user info. How can I retrieve user data when I listen Room snapshot. This is my database structure: Please help 回答1: Firestore does not have the concept of server-side joins or projections across collections. Each query or document read can only take data from a single collection, or from all collections that have the same name with collection group queries. If you need to load data from

Query data in multiple collections

纵饮孤独 提交于 2020-07-31 04:36:20
问题 I am developing a chat app using Firebase Firestore. I have a collection for room chat and another one for user info. How can I retrieve user data when I listen Room snapshot. This is my database structure: Please help 回答1: Firestore does not have the concept of server-side joins or projections across collections. Each query or document read can only take data from a single collection, or from all collections that have the same name with collection group queries. If you need to load data from

Query data in multiple collections

不羁的心 提交于 2020-07-31 04:36:08
问题 I am developing a chat app using Firebase Firestore. I have a collection for room chat and another one for user info. How can I retrieve user data when I listen Room snapshot. This is my database structure: Please help 回答1: Firestore does not have the concept of server-side joins or projections across collections. Each query or document read can only take data from a single collection, or from all collections that have the same name with collection group queries. If you need to load data from