google-cloud-firestore

How do I loop through a firestore document that has an array of maps?

我们两清 提交于 2020-04-30 11:09:51
问题 I mostly work with dictionaries since I am fairly new but here we have an embedded struct that I need to loop through. With this, I need to be able to populate expanding cells in UITableView. My struct looks like this: struct Complain: Codable { let eMail, message, timeStamp, userEmail: String let status: Bool let planDetails: PlanDetails enum CodingKeys: String, CodingKey { case eMail = "E-mail" case message = "Message" case timeStamp = "Time_Stamp" case userEmail = "User_Email" case status,

Parallel writes to Firestore using a Python 3.7 Cloud Function

本小妞迷上赌 提交于 2020-04-30 09:25:05
问题 As we can read in a note in this link about writing to Firestore: For bulk data entry, use a server client library with parallelized individual writes. Batched writes perform better than serialized writes but not better than parallel writes. You should use a server client library for bulk data operations and not a mobile/web SDK. I'm trying to program parallel writes to Firestore in a Python 3.7 Cloud Function. I have never programmed anything in parallel in Python, so I'm trying to use some

How to get the number of documents under a firestore collection? [duplicate]

☆樱花仙子☆ 提交于 2020-04-30 08:24:39
问题 This question already has answers here : Cloud Firestore collection count (13 answers) How to get count of documents in a collection? [duplicate] (2 answers) Closed 13 days ago . I want to get the total number of documents inside a firestore collection, I'm making a forum app, so I want to show the current amount of comments inside each discussion. There's something like db.collection("comments").get().lenght or something like that? 回答1: With the size property of the QuerySnapshot, you can

How to get the number of documents under a firestore collection? [duplicate]

喜欢而已 提交于 2020-04-30 08:22:05
问题 This question already has answers here : Cloud Firestore collection count (13 answers) How to get count of documents in a collection? [duplicate] (2 answers) Closed 13 days ago . I want to get the total number of documents inside a firestore collection, I'm making a forum app, so I want to show the current amount of comments inside each discussion. There's something like db.collection("comments").get().lenght or something like that? 回答1: With the size property of the QuerySnapshot, you can

how to use singleton firebase service on Flutter?

老子叫甜甜 提交于 2020-04-30 08:21:26
问题 I have 4 pages. I called getRide() method in every 4 pages. it's means 4 times database call. Am I right? Is it possible to create a singleton for this scenario? Firebase Service : class FirebaseService { final Firestore _db = Firestore.instance; Stream<List<RideModel>> getRide() { return _db.collection('ride') .snapshots() .map((list) => list.documents.map((doc) => RideModel.fromFirestore(doc)) .toList()); } } Calling Method : @override void initState() { super.initState(); db.getRide()

how to use singleton firebase service on Flutter?

一个人想着一个人 提交于 2020-04-30 08:21:19
问题 I have 4 pages. I called getRide() method in every 4 pages. it's means 4 times database call. Am I right? Is it possible to create a singleton for this scenario? Firebase Service : class FirebaseService { final Firestore _db = Firestore.instance; Stream<List<RideModel>> getRide() { return _db.collection('ride') .snapshots() .map((list) => list.documents.map((doc) => RideModel.fromFirestore(doc)) .toList()); } } Calling Method : @override void initState() { super.initState(); db.getRide()

How to fix “too much contention” on onCreate triggered by batch writes

孤街浪徒 提交于 2020-04-30 08:20:07
问题 I have school object with classrooms and students. Students are each family's sub-collection. When creating a school, I write several hundred families in several write batches. In creating each student, I want to do a few things: update a string in the student's family containing student first names students contain a classroom id, and I wish to update the classroom with some data from the student the school keeps separate list of students for easy lookup, and I want to add the students there

Error with query from Firebase in the .where statement

 ̄綄美尐妖づ 提交于 2020-04-30 07:11:47
问题 I have this function, but I´m having this error with the "where" statement. getUser() { this.db.collection("users").where("name", "==", "Maria") } ERROR: Property 'where' does not exist on type 'AngularFirestoreCollection'.ts(2339) 回答1: If you want to apply querying in firebase collection. You have to pass queryFn as a second argument to collection method. Try this: this.db.collection("users",(ref) => { let query : firebase.firestore.CollectionReference | firebase.firestore.Query = ref; query

Infinit loop with firebase and angular

倾然丶 夕夏残阳落幕 提交于 2020-04-30 07:01:17
问题 I'm having an infinit loop problem saving my data on firebase with this.db.collection('users').doc(this.useruid).update({Info: this.currentInfo}) private currentInfo:string[]; private useruid: string; ... constructor(private AngularAuth: AngularFireAuth, private db:AngularFirestore) { } ... sendInfo(text:string){ this.useruid = this.AngularAuth.auth.currentUser.uid; this.db.collection('users').doc(this.useruid).snapshotChanges().subscribe(a=>{ const data = a.payload.data() as {name:string,

Sending push notification from Angular and Firebase server

别说谁变了你拦得住时间么 提交于 2020-04-30 06:33:06
问题 I am able to send Push Notification using Postman. I don't want to use a separate server and send Push Notifications using PHP. Current using POST method - https://fcm.googleapis.com/fcm/send As I am using Firestore as database and Firebase as hosting to host my app How can I send notifications using Firebase server. Below is what I am using via Postman to send a notification at the moment. { "to": "my token id", "data": { "title": "Push Message", "message": "This is notification will change