google-cloud-firestore

How do import data from cloud firestore to the local emulator?

久未见 提交于 2020-05-16 13:54:13
问题 I want to be able to run cloud functions locally and debug against a copy from the production data. Is there a way to copy the data that is online to the local firestore emulator? 回答1: You can use the firestore-backup-restore to export and import your production data as JSON files. I wrote a quick hack to allow for importing these JSON in the Firebase Simulator Firestore instance. I proposed a pull request and made this npm module in the meantime. You can use it this way: const

Could not reach Cloud Firestore backend. Backend didnt respond within 10 seconds. (Firestore)

你离开我真会死。 提交于 2020-05-16 03:55:05
问题 I am having this problem in a new React-Native project even though I do have a good internet connection. @firebase/firestore: Firestore (7.13.2): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds. this is my Firebase config file: import firebase from 'firebase/app'; import { API_KEY, AUTH_DOMAIN, DATABASE_URL, PROJECT_ID, STORAGE_BUCKET, MESSAGING_SENDER_ID, APP_ID, MEASUREMENTID } from "react-native-dotenv"; const config = { apiKey: API_KEY, authDomain: AUTH

Firebase Firestore Server Timestamp with firebase-admin python sdk

 ̄綄美尐妖づ 提交于 2020-05-16 03:13:08
问题 There is a way to add server timestamps in firebase-admin python sdk ? I try: firestore.SERVER_TIMESTAMP firestore.constants.SERVER_TIMESTAMP but, i get this exception: TypeError: ('Cannot convert to a Firestore Value', <object object at 0x10380fc20>, 'Invalid type', <class 'object'>) 回答1: firestore.SERVER_TIMESTAMP worked for me. Here's the full example: import firebase_admin from firebase_admin import firestore # I have GOOGLE_APPLICATION_CREDENTIALS configured. firebase_admin.initialize

Maximum number of fields for a Firestore document?

◇◆丶佛笑我妖孽 提交于 2020-05-16 01:41:30
问题 Right now I have a products collection where I store my products as documents like the following: documentID: title: STRING, price: NUMBER, images: ARRAY OF OBJECTS, userImages: ARRAY OF OBJECTS, thumbnail: STRING, category: STRING NOTE: My web app has approximately 1000 products. I'm thinking about doing full text search on client side, while also saving on database reads, so I'm thinking about duplicating my data on Firestore and save a partial copy of all of my products into a single

Invalid query. You cannot use more than one 'in' filter

你离开我真会死。 提交于 2020-05-15 21:21:30
问题 this.ref.collection("users", ref => ref.where("uid1","in", [reciverId, senderId]) .where("uid2","in", [reciverId, senderId])) give me error like "Invalid query. You cannot use more than one 'in' filter" 回答1: This is indeed a limitation of Firestore, as explained in the documentation: Limitations Note the following limitations for in and array-contains-any: in and array-contains-any support up to 10 comparison values. You can use only one in or array-contains-any clause per query . You can't

Number of update fields in firestore security rules

我的梦境 提交于 2020-05-15 10:55:08
问题 I am making batch operation from client to update only one field but while making batch operation and on testing in security rules It is observed that more than one fields are being updated. I checked this using request.resource.data.size() >1 and request.resource.data.keys().size()>1 returning true (document being updated) but this is not intended as I want to check in security rules that only one field is being updated using checks like request.resource.data.keys().hasOnly([

Sign up with email, first name, last name using SwiftUI and Firestore

强颜欢笑 提交于 2020-05-15 09:15:48
问题 I want to authenticate the user and create an user database with Firestore using users name ( first and last ). I can create the user but I couldn’t manage to create the database at the same time. This is my SessionStore which works for signup and signin. By Signup I want to grab the name of the user and create a database. ( no code down below because nothing worked) I am a beginner so I would appreciate an elaborate answer. Thanks a lot! import Firebase import Combine class SessionStore:

Can't get FirestoreRecyclerAdapter to show items

一笑奈何 提交于 2020-05-15 08:27:05
问题 I'm updating my app to use Firebase's Firestore database. I'm struggling to get the app to show the data that's been retrieved from the database. The data is retrieved ok, but doesn't show up. By setting breakpoints, I've established that the ViewHolder isn't being bound to the adapter at any point. The data is being shown in a Fragment. The Fragment layout is (I've taken out irrelevant stuff like padding, sizes etc): <android.support.constraint.ConstraintLayout android:id="@+id/layout_charts

Firebase security rules, ensure one “array remove” only, and only to userId

本秂侑毒 提交于 2020-05-15 08:15:06
问题 I have notification records where there is a text and a list of users (max 10). {text: "Beware of the dog", users: [ uid1, uid2, uid3, ... ]} When a user read/acknowledge the notification, I want to remove him from the list of users who can see the notification (then he won't get any anymore). For that, when the user press the "hide notification button", he send a request to update the notification record with: users: FieldValue.arrayRemove(uid) I want to enfore with security rules that the

Firebase emulator return empty data whereas working fine after deploying

北城余情 提交于 2020-05-15 08:08:13
问题 I have a written a very basic API which will return the services. I tried to run this API in emulator but it return the empty data { "status": "success", "statusCode": 200, "message": "Services retrieved", "data": [] } I have setup the firestore, functions and database emulators. And I am using "firebase-admin": "^8.10.0", "firebase-functions": "^3.6.0" Any idea why the data response is empty ? EDIT This is my method to call the service export const activeServices = functions.https.onRequest(