google-cloud-firestore

How to get an Array of Objects from Firestore in Swift?

好久不见. 提交于 2020-08-20 02:18:27
问题 In Swift, to retrieve an array from Firestore I use: currentDocument.getDocument { (document, error) in if let document = document, document.exists { let people = document.data()!["people"] print(people!) } else { print("Document does not exist") } } And I receive data that looks like this ( { name = "Bob"; age = 24; } ) However, if I were to retrieve the name alone, normally I'd do print(document.data()!["people"][0]["name"]) . But the response I get is Value of type 'Any' has no subscripts

Firestore timestamp getting null

最后都变了- 提交于 2020-08-19 16:46:31
问题 I'm using firestore in my android project, everything working fine.But Yesterday an issue occurred on getting timestamp value from document snapshot. if (documentChange.getType() == DocumentChange.Type.ADDED) { Map<String, Object> stringObjectMap = documentChange.getDocument().getData(); Date date = (Date) stringObjectMap.get("timestamp"); } This is one of my Collection Document. id : "25", message : "This is my message", timestamp : December 11, 2017 at 10:39:12 PM UTC+5, \\This is Firebase

Firestore, how to structure a “likedBy” query

被刻印的时光 ゝ 提交于 2020-08-19 10:16:43
问题 I'm having a little trouble wrapping my head around how to best structure my (very simple) Firestore app. I have a set of users like this: users: { 'A123': { 'name':'Adam' }, 'B234': { 'name':'Bella' }, 'C345': { 'name':'Charlie' } } ...and each user can 'like' or 'dislike' any number of other users (like Tinder). I'd like to structure a "likes" table (or Firestore equivalent) so that I can list people who I haven't yet liked or disliked. My initial thought was to create a "likes" object

Can't create firebase indexing due to this message This page has moved to new location. Please update your bookmarks

这一生的挚爱 提交于 2020-08-19 07:30:09
问题 When I try to create a firebase indexing through the link that is created automatically it shows in a popup message "This page has moved to a new location. Please update your bookmarks." and it doesn't create the firebase indexing can someone help me? a screenshot of the message shown 回答1: My link was without the "database" word already, but when I changed the: ..google.com/v1/r/... to ..google.com/u/0/... it worked. Note the "v1" and "r" is replaced in the working link for me. I am using

How to achieve notifications whenever there is change in Firebase Firestore Android?

我的未来我决定 提交于 2020-08-17 18:17:30
问题 There are two types of apps one which will be used by users and the other which will be used by me i.e the owner. So whenever any users add a content (data) to the Cloud Firestore database, I want to get notified. In short, how to send notifications whenever there is a change in Cloud Firestore database? 回答1: The simplest way to achieve this is to use Cloud Functions for Firebase. This will help you notify users when something interesting happens, in your case, when users will add content

flutter - add to firestore collection if not exists otherwise update

偶尔善良 提交于 2020-08-11 03:33:32
问题 In flutter, I am using firestore to store my users that log in. I want if a user login the first time to add his information to a collection. If he logout, then logs in, I want to update his document in the collection. To check if there is a document corresponding to the user, I want to check by his 'id' which is a field in the document, and not by the document tag, since I get the 'id' from firebase api. Here is the add which is working correctly _firestore.collection('profiles').add({

flutter - add to firestore collection if not exists otherwise update

你说的曾经没有我的故事 提交于 2020-08-11 03:29:47
问题 In flutter, I am using firestore to store my users that log in. I want if a user login the first time to add his information to a collection. If he logout, then logs in, I want to update his document in the collection. To check if there is a document corresponding to the user, I want to check by his 'id' which is a field in the document, and not by the document tag, since I get the 'id' from firebase api. Here is the add which is working correctly _firestore.collection('profiles').add({

Firebase function onCall, response: Warning, FIREBASE_CONFIG environment variable is missing. Initializing firebase-admin will fail

。_饼干妹妹 提交于 2020-08-11 02:49:30
问题 I try to call my test function from local project. But all time when i call, i take 401 error. I don't know what trouble here, in front end i have init app with api key, in firebase function i have admin.credential.applicationDefault() ; I tried to pass admin.credential.cer(apiConfig) , but this don't help to. I also have Environment variable GOOGLE_APPLICATION_CREDENTIALS , with path to my config. Dependencies "firebase-admin": "~7.0.0", "firebase-functions": "^2.2.0", "firebase-functions

Defining Constructors in Model Class (Get Data with Cloud Firestore)

删除回忆录丶 提交于 2020-08-10 22:55:22
问题 I added some data in Cloud Firestore enter image description here in which I am having String title, String desc, String[] photos I want to get that data in MyClass.class so I provided Parameterized Constructor and Getter & Setters in the class. But the error said Converting to Arrays is not supported, please use Lists instead This is my code for logical part: FirebaseFirestore db = FirebaseFirestore.getInstance(); db.collection("gallery") .get() .addOnCompleteListener(new OnCompleteListener

Defining Constructors in Model Class (Get Data with Cloud Firestore)

心不动则不痛 提交于 2020-08-10 22:53:53
问题 I added some data in Cloud Firestore enter image description here in which I am having String title, String desc, String[] photos I want to get that data in MyClass.class so I provided Parameterized Constructor and Getter & Setters in the class. But the error said Converting to Arrays is not supported, please use Lists instead This is my code for logical part: FirebaseFirestore db = FirebaseFirestore.getInstance(); db.collection("gallery") .get() .addOnCompleteListener(new OnCompleteListener