google-cloud-firestore

How to get Firestore GeoPoint value in nested Object?

隐身守侯 提交于 2020-01-07 08:05:13
问题 Here is my temporary code for generate geopoint datatype from Firestore DB firestoreDb.collection("products").document(productId).get() .addOnSuccessListener(documentSnapshot -> { Products products = documentSnapshot.toObject(Products.class); countryCode = Objects.requireNonNull(products.getAddress().get("countryCode")).toString(); String stringGeoPoint = products.getLocation().get("geoPoint").toString(); System.out.println(stringGeoPoint); //Output: GeoPoint { latitude=29.339555, longitude

Firestore permissions

六眼飞鱼酱① 提交于 2020-01-07 04:57:28
问题 How do I configure permissions so that a user can only read and write documents where they are the owner? my documents have a top level attribute called owner. I read these docs https://firebase.google.com/docs/firestore/security/secure-data?authuser=0#the_resource_variable and it seems like this should work? service cloud.firestore { match /databases/{database}/documents { match /analysis/{analysis} { allow read, write: if request.auth.email == resource.data.owner } } } however this doesn't

Issue in authentication in firebase cloud firestore at user level

孤人 提交于 2020-01-06 12:43:08
问题 I am analysing the get started guide for firebase cloud firestore. This is for an android app. https://firebase.google.com/docs/firestore/security/get-started I need to save and read the user data from every android device for backing up some data. The document for firebase cloud firestore shows the below code for accessing the data for all users. But I want to restrict the user data to be private so that it can be accessed only by the user who saved it. Please advice how to proceed with the

Issue in authentication in firebase cloud firestore at user level

冷暖自知 提交于 2020-01-06 12:42:35
问题 I am analysing the get started guide for firebase cloud firestore. This is for an android app. https://firebase.google.com/docs/firestore/security/get-started I need to save and read the user data from every android device for backing up some data. The document for firebase cloud firestore shows the below code for accessing the data for all users. But I want to restrict the user data to be private so that it can be accessed only by the user who saved it. Please advice how to proceed with the

Cloud Firestore don't display data on Fragments After Swipe

风流意气都作罢 提交于 2020-01-06 12:36:26
问题 I have created an app with Firebase Cloud Firestore. I'm trying to list my orders to a recyclerview in between fragments. I have a Fragment: OrderListFragment // RecyclerView mOrderAdapter = object : OrderAdapter(getQuery(mFirebaseFirestore), this@OrderListFragment) { override fun onDataChanged() { super.onDataChanged() mRecyclerView.visibility = View.VISIBLE } override fun onError(e: FirebaseFirestoreException) { super.onError(e) showShortToast(context!!, "Error: " + e.toString()) // Show a

Return all docs when all docs are deleted in a collection in Firestore

人盡茶涼 提交于 2020-01-06 11:18:37
问题 I am using the code below to remove all docs in a collection in Firestore. My question is, how to execute a function which will return the result (promise) of 'deleteCollection' among with an array with the deleted docs? I want to loop over all the docs. I surely can query all the data first, loop through it and than execute this function, but than the data gets read twice. Another option would be creating a empty global variable in which the delete function adds the doc. But how safe is this

Return all docs when all docs are deleted in a collection in Firestore

喜欢而已 提交于 2020-01-06 11:18:28
问题 I am using the code below to remove all docs in a collection in Firestore. My question is, how to execute a function which will return the result (promise) of 'deleteCollection' among with an array with the deleted docs? I want to loop over all the docs. I surely can query all the data first, loop through it and than execute this function, but than the data gets read twice. Another option would be creating a empty global variable in which the delete function adds the doc. But how safe is this

Angular Firestore display a button depending of a returned boolean which checks if an Firestore document exist

一个人想着一个人 提交于 2020-01-06 09:36:14
问题 Requested behaviour: Displaying a button in an Angular view depending on a returned boolean of an Angular Service which checks if a Firestore document exists Current State The Service checks the existence of the document successfully. It also updates the global variable in the if/else statement. I can call the function in the service and it logs the boolean value but it does not return it. Issue When I call the function from the component it always logs [object Promise] and I get a ts lint

Problem with the UploadTask from putString()

只愿长相守 提交于 2020-01-06 08:47:26
问题 I am having problems with the UploadTask from Firebase Storage. I am trying to upload an image and then saving the image URL on Firestore Cloud. To do so I have this code: newuploadImage() { this.image = 'movie-' + new Date().getTime() + '.jpg'; let storageRef: any, parseUpload: any; storageRef = firebase.storage().ref('imgs/' + this.image); parseUpload = storageRef.putString(this.cameraImage, 'data_url') parseUpload.on('state_changed', function (snapshot) { }, function (error) { }, function

Firestore, Angular, AngularFire2 - Adding document with a reference type field

谁都会走 提交于 2020-01-06 08:44:33
问题 Is there a way to add a document with a reference type field to a collection? 回答1: Oh ... I made a mistake ... it's simple - we get a reference DocumentReference type (like this.firestoreService.doc(ref).ref ) and store it in our object. 来源: https://stackoverflow.com/questions/49935811/firestore-angular-angularfire2-adding-document-with-a-reference-type-field