google-cloud-firestore

Firestore query where map contains string

岁酱吖の 提交于 2021-01-04 12:34:49
问题 Data structure: houses (collection) name (string) users (map) 90c234jc23 (map) percentage: 100% (string/number) Rules: allow read: request.auth.uid in resource.data.users; The problem is when I try to query houses which user owns: FirebaseFirestore.getInstance().collection(House.COLLECTION) // .whereArrayContains(House.USERS_FIELD, currentUser.getUid()) // does not work .whereEqualTo("users." + currentUser.getUid(), currentUser.getUid()) // does not work either .get() No result are returned.

How to fix 'getter “documents” was called on null.' in flutter

守給你的承諾、 提交于 2021-01-03 06:26:07
问题 I am using flutter and firebase to create a mobile app. I have 2 collections on my firestore and i wanna read all documents in a the collection "posts". However, when I do that, an error saying the getter "documents" was called on null. Widget getContent(BuildContext context) { return StreamBuilder<QuerySnapshot>( stream: Firestore.instance.collection("posts").snapshots(), builder: (context, snap) { return CarouselSlider( enlargeCenterPage: true, height: MediaQuery.of(context).size.height,

“The requested snapshot version is too old.” error in Firestore

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-03 03:55:54
问题 While using Swift client for firebase, starting Feb 09, I started to see the error message "The requested snapshot version is too old." in the callback of addSnapshotListener. What does that error mean? How can I fix it? Thanks! 来源: https://stackoverflow.com/questions/60175102/the-requested-snapshot-version-is-too-old-error-in-firestore

“The requested snapshot version is too old.” error in Firestore

╄→гoц情女王★ 提交于 2021-01-03 03:55:15
问题 While using Swift client for firebase, starting Feb 09, I started to see the error message "The requested snapshot version is too old." in the callback of addSnapshotListener. What does that error mean? How can I fix it? Thanks! 来源: https://stackoverflow.com/questions/60175102/the-requested-snapshot-version-is-too-old-error-in-firestore

FIrebase Firestore onCreate Cloud Function Event Params Undefined

蓝咒 提交于 2021-01-02 06:36:14
问题 I have tried following Firebase's documentation and other SO posts to access a parameter value for a cloud function I've successfully deployed. Unfortunately I've still been receiving a Type Error: cannot read property 'id' of undefined I've logged event.params and it is outputting as undefined, so I understand the issue, but am unsure how, syntactically, I'm supposed to derive the param value. Below is my js code for reference: exports.observeCreate = functions.firestore.document('/pathOne/

how to get document id on tapping the uitablecellviewcell in Firestore in swift

孤人 提交于 2021-01-01 17:53:03
问题 How should I get the document id upon tapping the UItableViewCell? I know the below code do give me the row index, but for a feed post I would like to get the document id for the the particular post everytime I have tried to retrieve the document id through key setup in model file but avail to no good func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print("row selected: \(indexPath.row)") performSegue(withIdentifier: "toDetailView", sender: indexPath) } Posts

how to get document id on tapping the uitablecellviewcell in Firestore in swift

本小妞迷上赌 提交于 2021-01-01 17:51:27
问题 How should I get the document id upon tapping the UItableViewCell? I know the below code do give me the row index, but for a feed post I would like to get the document id for the the particular post everytime I have tried to retrieve the document id through key setup in model file but avail to no good func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { print("row selected: \(indexPath.row)") performSegue(withIdentifier: "toDetailView", sender: indexPath) } Posts

Handling asynchronous Firestore data reading in tableView - iOS

这一生的挚爱 提交于 2021-01-01 10:12:57
问题 I would like to retrieve data from my simple Firestore database I have this database: then I have a model class where I have a method responsible for retrieving a data which looks like this: func getDataFromDatabase() -> [String] { var notes: [String] = [] collectionRef = Firestore.firestore().collection("Notes") collectionRef.addSnapshotListener { querySnapshot, error in guard let documents = querySnapshot?.documents else { print("Error fetching documents: \(error!)") return } notes =

Handling asynchronous Firestore data reading in tableView - iOS

青春壹個敷衍的年華 提交于 2021-01-01 10:07:41
问题 I would like to retrieve data from my simple Firestore database I have this database: then I have a model class where I have a method responsible for retrieving a data which looks like this: func getDataFromDatabase() -> [String] { var notes: [String] = [] collectionRef = Firestore.firestore().collection("Notes") collectionRef.addSnapshotListener { querySnapshot, error in guard let documents = querySnapshot?.documents else { print("Error fetching documents: \(error!)") return } notes =

Closure call with mismatched arguments: function '[]' error is being shown in flutter

纵饮孤独 提交于 2021-01-01 09:03:28
问题 In my program, this error comes in my laptop only. I typed the exact code as of the tutorial, but in tutorial, it is working fine, and i am getting this error - Closure call with mismatched arguments: function '[]' Receiver: Closure: () => Map<String, dynamic> from Function 'data':. Tried calling: []("message") Found: []() => Map<String, dynamic> This is my code, in which error is coming. If you want full details of functions, you can comment it out, and i will provide you the same in