google-cloud-firestore

listDocuments exist in @google-cloud/firestore but not firebase npm module: what's the difference?

放肆的年华 提交于 2021-01-29 07:14:39
问题 I've been using the firebase npm package to primarily interact with my Cloud Firestore + Authentication. I want to use the listDocuments method on a collection, but this doesn't seem to exist in when I have: import * as firebase from "firebase"; import "firebase/firestore"; const db = firebase.initializeApp(...).firestore(); db.collection("users").listDocuments() And it says that listDocuments() is not a function. I've tried also installing @google-cloud/firestore npm package but that seems

Unhandled Exception: type 'String' is not a subtype of type 'double' even if a double is given

送分小仙女□ 提交于 2021-01-29 07:02:42
问题 I'm fetching coordinates from Firestore to fill my map with stores locations. The Google Map Marker needs a LatLng object (that takes two double as parameters) with the latitude and longitude of a point. But, for each increment, I get the following exception: type 'String' is not a subtype of type 'double' (verbose down below). However, the points do appear on the map, which should mean that the values ARE of type double... I used the following code to identify the latitude and longitude type

connecting google firestore to php - grpc not found

大城市里の小女人 提交于 2021-01-29 07:00:43
问题 I am trying to connect php to firestore database following this repo https://github.com/googleapis/google-cloud-php-firestore. Google Cloud Firestore for php requires grpc extension to be installed. I have installed grpc through pecl and it says it is perfectly installed. But whenever I try to run the code, it says firestore could not connect because grpc extension could not be found. I am attaching the screenshots of errors here. I have even added grpc to php.ini file, not sure why this

Unable to add data to custom User collection properly in Firestore

亡梦爱人 提交于 2021-01-29 06:49:10
问题 Problem I'd like to add several user data to firestore Authenticateced user list AND to users collection which I created by myself at same time, but it does't go well. users collection are updated only its part of it. Data // javascript users: [ {email: "n_0@example.com", username: "user0"}, {email: "n_1@example.com", username: "user1"}, {email: "n_2@example.com", username: "user2"}, {email: "n_3@example.com", username: "user3"}, {email: "n_4@example.com", username: "user4"} ] Code //

Retrieving Data From Firestore in time

强颜欢笑 提交于 2021-01-29 06:47:50
问题 I have looked all over the internet for how to fix this problem and I can't find a solution anywhere. I am using flutter with firestore to make an app. I want to make it so when the user logins into the app at the top shows their name (simple right). I can get data from firestore: Future<void> getName() async { print("Attemping to get name!"); final firestoreInstance = await FirebaseFirestore.instance; FirebaseAuth auth = FirebaseAuth.instance; String uid = auth.currentUser.uid.toString();

Firestore: Usage of request.resource.size rule returns FirebaseError: Missing or insufficient permissions

无人久伴 提交于 2021-01-29 06:44:02
问题 I am trying to set up a firestore security rule to restrict the size of incoming data. service cloud.firestore { match /databases/{database}/documents { match /events/{eventId}{ allow read: if request.auth.uid != null; allow write: if request.auth.uid != null && request.resource.size < 1*1024*1024; } } } Above security rule returns an error FirebaseError: Missing or insufficient permissions. How do I validate the size of the incoming data without the error? Firestore structure firestore_db

How do I save data from cloud firestore to a variable in swift?

我们两清 提交于 2021-01-29 06:38:46
问题 I want to save a particular field from a document into a variable. My code so far: func getDocument(path: String, field: String? = "nil") -> some Any{ var returnVar : Any = "DEFAULT VAL" var db: Firestore! db = Firestore.firestore() let docRef = db.document(path) docRef.getDocument { (document, error) in if let document = document, document.exists { if(field != "nil"){ let property = document.get("phrase") ?? "nil" returnVar = property return; } else{ let dataDescription = document.data().map

How to read collection only if UID matches collection name in Firebase Firestore?

和自甴很熟 提交于 2021-01-29 06:33:48
问题 I created a Collection of user IDs for each user and I want to set the database rules to read the collection item only if the user ID matches the collection item name. I tried something like: service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read: if request.auth != null; } match /{userId} { allow read: if belongsTo(userId); } function belongsTo(userId) { return request.auth.uid == userId } } } 回答1: Firestore reads documents. There is no concept of

Vue.js: Cannot retrieve data from cloud firestore

非 Y 不嫁゛ 提交于 2021-01-29 06:32:41
问题 I created the database on cloud firestore, and the collection name is products. Now I want to retrieve all the resources in my collection. I have already created 12 products in my database. But in my vue-devtool, I cannot see any array. How can I retrieve the data from cloud firestore? Here is my vue.js code. <template> <h3 class="d-inline-block">Products list</h3> <div class="product-test"> <div class="form-group"> <input type="text" placeholder="Product name" v-model="product.name" class=

Accessing Firestore from Firebase Realtime Database Security Rules

♀尐吖头ヾ 提交于 2021-01-29 06:28:57
问题 I'm actively using both of Firebase Realtime Database and Firestore. There is a case in which I need to check a document on Firestore to allow user to write on Firebase Realtime Database. Basically, I need to access user's document in the users collection on Firestore to allow user to create a post under the posts node on Firebase Realtime Database. Is something like this possible, by any chance? "rules": { "posts": { ".write": "get(/databases/$(database)/documents/users/$(auth.uid)).data