google-cloud-firestore

Asynchronous Firebase query to response

会有一股神秘感。 提交于 2020-07-23 08:35:07
问题 I'm trying to get all documents from a firebase collection, create a list and return it on request with a Cloud Function, but I'm struggling with the asynchronous nature of JavaScript. Here's my code so far: firebase.initializeApp(firebaseConfig); const db = firebase.firestore(); const items = ""; async function buildItems() { db.collection("reminders").get().then((QuerySnapshot) => { QuerySnapshot.forEach((item) => { items.concat("<li>" + item.data().name + "</li>"); console.log(items); });

Asynchronous Firebase query to response

自古美人都是妖i 提交于 2020-07-23 08:34:28
问题 I'm trying to get all documents from a firebase collection, create a list and return it on request with a Cloud Function, but I'm struggling with the asynchronous nature of JavaScript. Here's my code so far: firebase.initializeApp(firebaseConfig); const db = firebase.firestore(); const items = ""; async function buildItems() { db.collection("reminders").get().then((QuerySnapshot) => { QuerySnapshot.forEach((item) => { items.concat("<li>" + item.data().name + "</li>"); console.log(items); });

Firebase pagination in flutter

戏子无情 提交于 2020-07-23 08:04:47
问题 i'm using Firebase firestore for an app i'm working on. Basically, i have a Collection('Chat') that may contain thousand of documents i need a way to implement firebase pagination to limit how much document is retrieved from the backend. im using streamBuilder and passing the Query below as stream : stream: widget.messageDocRef .collection('Chat').orderBy('timestamp', descending: true) .limit(80) .snapshots(); i have a ListView and a scrollController for it, code: ListView( physics: const

Firebase pagination in flutter

你离开我真会死。 提交于 2020-07-23 08:04:22
问题 i'm using Firebase firestore for an app i'm working on. Basically, i have a Collection('Chat') that may contain thousand of documents i need a way to implement firebase pagination to limit how much document is retrieved from the backend. im using streamBuilder and passing the Query below as stream : stream: widget.messageDocRef .collection('Chat').orderBy('timestamp', descending: true) .limit(80) .snapshots(); i have a ListView and a scrollController for it, code: ListView( physics: const

Firebase pagination in flutter

天大地大妈咪最大 提交于 2020-07-23 08:02:10
问题 i'm using Firebase firestore for an app i'm working on. Basically, i have a Collection('Chat') that may contain thousand of documents i need a way to implement firebase pagination to limit how much document is retrieved from the backend. im using streamBuilder and passing the Query below as stream : stream: widget.messageDocRef .collection('Chat').orderBy('timestamp', descending: true) .limit(80) .snapshots(); i have a ListView and a scrollController for it, code: ListView( physics: const

Firebase.default.auth().currentUser.uid is null after createUserWithEmailAndPassword()

时光总嘲笑我的痴心妄想 提交于 2020-07-23 07:49:04
问题 I'm trying to create a new document on my "users" collection on Firebase for any new user created on the Signup screen for my React-Native app, and the document is supposed to include the new user's uid, first name, last name, phone number, and date of birth. The issue is, after I use createUserWithEmailAndPassword to create a user, when I try to grab the uid with currentUser.uid, I get the following error: null is not an object (evaluating '_Firebase.default.auth().currentUser.uid'). I've

Firebase.default.auth().currentUser.uid is null after createUserWithEmailAndPassword()

余生长醉 提交于 2020-07-23 07:48:27
问题 I'm trying to create a new document on my "users" collection on Firebase for any new user created on the Signup screen for my React-Native app, and the document is supposed to include the new user's uid, first name, last name, phone number, and date of birth. The issue is, after I use createUserWithEmailAndPassword to create a user, when I try to grab the uid with currentUser.uid, I get the following error: null is not an object (evaluating '_Firebase.default.auth().currentUser.uid'). I've

Swift - Firestore Document references must have an even number of segments, but

前提是你 提交于 2020-07-23 07:37:06
问题 Xcode is giving me this error message: Document references must have an even number of segments, but users/hsiYfWgKz7MVOM77gMPkQYBHYJH2/wishlists has 3' I have no idea why that error occurs because I thought there are 4 segments with this code: let wishListName = self.popUpView.popUpTextField.text! let db = Firestore.firestore() let userID = Auth.auth().currentUser!.uid db.collection("users").document(userID).collection("wishlists").document(wishListName).setData(["name": wishListName]) {

Swift - Firestore Document references must have an even number of segments, but

余生长醉 提交于 2020-07-23 07:36:08
问题 Xcode is giving me this error message: Document references must have an even number of segments, but users/hsiYfWgKz7MVOM77gMPkQYBHYJH2/wishlists has 3' I have no idea why that error occurs because I thought there are 4 segments with this code: let wishListName = self.popUpView.popUpTextField.text! let db = Firestore.firestore() let userID = Auth.auth().currentUser!.uid db.collection("users").document(userID).collection("wishlists").document(wishListName).setData(["name": wishListName]) {

Swift - Firestore Document references must have an even number of segments, but

…衆ロ難τιáo~ 提交于 2020-07-23 07:35:13
问题 Xcode is giving me this error message: Document references must have an even number of segments, but users/hsiYfWgKz7MVOM77gMPkQYBHYJH2/wishlists has 3' I have no idea why that error occurs because I thought there are 4 segments with this code: let wishListName = self.popUpView.popUpTextField.text! let db = Firestore.firestore() let userID = Auth.auth().currentUser!.uid db.collection("users").document(userID).collection("wishlists").document(wishListName).setData(["name": wishListName]) {