google-cloud-firestore

Firestore - Pass Array To arrayUnion()

 ̄綄美尐妖づ 提交于 2020-08-27 02:16:15
问题 How do you pass an array to the firebase firestore arrayUnion() function? I am getting this error when I try to pass an array. Error Error: 3 INVALID_ARGUMENT: Cannot convert an array value in an array value. Example let myArray = ["1", "2", "3"]; docRef.update({ test: firebase.firestore.FieldValue.arrayUnion(myArray) }); 回答1: I eventually found the answer of using Function.prototype.apply() in another stack overflow answer. Example For Function.prototype.apply() let myArray = ["1", "2", "3"]

Firestore delete document and all documents referencing it

你。 提交于 2020-08-26 13:42:26
问题 this question is regarding Firebase (+ Flutter) is it possible to delete a document and all documents referencing it? Lets assume i have a structure like this: -users (collection) - name - bookmarks ((sub)collection) - postId -post (collection) - userId - name - ... Now if i delete a post, i want to delete all bookmarks referencing that post. (From all users). Is there an automatic way (coming from RDBMS). Another question: How can i query all posts and "join" the user infos. Something like

Firestore delete document and all documents referencing it

元气小坏坏 提交于 2020-08-26 13:42:08
问题 this question is regarding Firebase (+ Flutter) is it possible to delete a document and all documents referencing it? Lets assume i have a structure like this: -users (collection) - name - bookmarks ((sub)collection) - postId -post (collection) - userId - name - ... Now if i delete a post, i want to delete all bookmarks referencing that post. (From all users). Is there an automatic way (coming from RDBMS). Another question: How can i query all posts and "join" the user infos. Something like

Firestore startAfter() returning the same data in infinite scrolling when ordered by descending timestamp

断了今生、忘了曾经 提交于 2020-08-26 09:08:54
问题 I'm writing a profile page with chronological user posts (latest post on top) using Firestore on Ionic by setting orderBy () to " timestamp " descending . I'm using Ionic's infinite loading to load more posts when the user reaches the bottom, but the result is that Firestore loads the exact same posts over and over again. Please help! Hi! Sorry if this is a beginner question, but I've been wrapping my head around this for sever hours to no avail. The pagination works properly when in

I am trying to fetch data from Firestore database in my ios Swift Project

心不动则不痛 提交于 2020-08-26 06:48:32
问题 I want to fetch data from team of subscription collection. I am trying following code: db.collection("subscriptions").addSnapshotListener { querySnapshot, error in guard let snapshot = querySnapshot else { print("Error retreiving snapshots \(error!)") return } //print("Current data: \(snapshot.documents.map { $0.data() })") for document in snapshot.documents{ print(document.data()) } } Output of my Code So, as far concern i am able to fetch the data of collections but not able to get data

I am trying to fetch data from Firestore database in my ios Swift Project

。_饼干妹妹 提交于 2020-08-26 06:47:06
问题 I want to fetch data from team of subscription collection. I am trying following code: db.collection("subscriptions").addSnapshotListener { querySnapshot, error in guard let snapshot = querySnapshot else { print("Error retreiving snapshots \(error!)") return } //print("Current data: \(snapshot.documents.map { $0.data() })") for document in snapshot.documents{ print(document.data()) } } Output of my Code So, as far concern i am able to fetch the data of collections but not able to get data

Firestore createId() ids not in chronological order

。_饼干妹妹 提交于 2020-08-25 07:04:51
问题 In Firebase realtime database, autogenerating ids keeps all entries in chronological order of when they were created. Firestore seems to be completely random. Is there a way to create ids the same way they're generated in database? Or do I need to pass a creation timestamp and sort by this? 回答1: From the Firestore documentation on adding data: Important : Unlike "push IDs" in the Firebase Realtime Database, Cloud Firestore auto-generated IDs do not provide any automatic ordering. If you want

Firebase deploy error - Cannot find module 'firebase'

家住魔仙堡 提交于 2020-08-24 09:20:35
问题 I'm trying to deploy Google Cloud function triggers that trigger from db events, but when I run firebase deploy The functions aren't deployed properly and I get an error saying Error: Cannot find module firebase When I was first creating the project I could deploy functions without any issues. It's been a few days since I last deployed anything, but now I'm getting this issue on all my functions (not just my trigger functions) My function: exports.deleteNotificationOnUnlike = functions

Firebase deploy error - Cannot find module 'firebase'

这一生的挚爱 提交于 2020-08-24 09:19:38
问题 I'm trying to deploy Google Cloud function triggers that trigger from db events, but when I run firebase deploy The functions aren't deployed properly and I get an error saying Error: Cannot find module firebase When I was first creating the project I could deploy functions without any issues. It's been a few days since I last deployed anything, but now I'm getting this issue on all my functions (not just my trigger functions) My function: exports.deleteNotificationOnUnlike = functions

Firestore unsubscribe to updates

社会主义新天地 提交于 2020-08-24 07:41:42
问题 I am following this Google Cloud Firestore example on YouTube and getting real time updates successfully. However, I don't know how to unsubscribe to updates because it's not explained in the video. I read the documentation to create an unsubscribe() function but it doesn't work for me. getRealtimeUpdates = function(document) { firestore.collection("collection_name") .onSnapshot(function(querySnapshot) { querySnapshot.forEach(function(doc) { if (doc && doc.exists) { const myData = doc.data();