google-cloud-firestore

Firestore Security Rules allow specific field only [duplicate]

為{幸葍}努か 提交于 2021-01-20 11:27:33
问题 This question already has answers here : How to allow only particular fields of a firestore document to be accessed publicly (1 answer) Can I restrict certain fields in firestore database to be only fetched by firebase admin? (2 answers) Closed 6 months ago . I am trying to implement security rule to limit users to access only specific fields inside a document. My data structure goes like this: document { name: John, dob: 1994, email: john@hotmail.com } I want to limit the name field to read,

Retrieving Document Id from Firestore Collection (Android)

孤人 提交于 2021-01-20 09:08:22
问题 I'm trying to extract the auto-generated Id under a document so I can use it elsewhere. Here is the full code: mStartChatButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { final HashMap<String, Object> myChatFields = new HashMap<>(); myChatFields.put("dateJoined", ServerValue.TIMESTAMP ); myChatFields.put("status", ""); myChatFields.put("snoozeUntil", ""); myChatFields.put("myCharacter", ""); myChatFields.put("requestedCustomChatCode", "");

Retrieving Document Id from Firestore Collection (Android)

白昼怎懂夜的黑 提交于 2021-01-20 09:06:16
问题 I'm trying to extract the auto-generated Id under a document so I can use it elsewhere. Here is the full code: mStartChatButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { final HashMap<String, Object> myChatFields = new HashMap<>(); myChatFields.put("dateJoined", ServerValue.TIMESTAMP ); myChatFields.put("status", ""); myChatFields.put("snoozeUntil", ""); myChatFields.put("myCharacter", ""); myChatFields.put("requestedCustomChatCode", "");

How to mock the FirebaseApp in flutter

对着背影说爱祢 提交于 2021-01-20 07:59:11
问题 I am trying to test a method that uses FirebaseFirestore but I am not able to mock the FirebaseFirestore.instance property. I am following these examples: Initializing the core: https://firebase.flutter.dev/docs/overview#initializing-flutterfire Using the firestore plugin: https://firebase.flutter.dev/docs/firestore/usage I am using the code below for my class and it is working well, which means the firestoreInstance is loaded correctly import 'package:cloud_firestore/cloud_firestore.dart';

How to use a .catch in firebase onSnapshot

柔情痞子 提交于 2021-01-20 07:26:08
问题 I've created an Ionic Firebase chat app. The problem I think I'm having is I've set up a query snapshot on initialization of the message page with the following: ngOnInit() { this.messageService.getAllMessages() .doc(`${this.userId[0] + '-' + this.userId[1]}`) .collection('message') .orderBy('createdAt', 'asc') .onSnapshot((doc) => { this.messages = []; doc.forEach((snap) => { this.messages.push({ content: snap.data().content, createdAt: snap.data().createdAt, userId: snap.data().userId }); }

Activate retry in firebase cloud function programmatically

怎甘沉沦 提交于 2021-01-19 05:55:58
问题 i'm deploying firebase cloud functions to listen on changes in our firestore via continuous deployment. I can only find a way to activate retries manually. Which goes contrary to our cd approach. Looking at the normal gcp cloud functions the retry flag can be given when deploying. But i cannot find a similar option in the firebase-cli or the firebase-functions interface (2.1.0) Any hints on how to solve this? Carsten 回答1: There is currently no similar option for deployment using the Firebase

Firestore DeadlineExceeded exception for big collections

眉间皱痕 提交于 2021-01-18 04:36:47
问题 I'm trying to read bigger collections from Google Firestore for testing and archiving purposes. I'm hitting some interesting errors when I try to get all documents from collections with more than 6k documents in them. Naive Python solution My first try was using the Python google-cloud-firestore (version 0.30.0) library. source_client = firestore.Client() source = source_client.collection(collection) source_data = source.get() counter = 0 for f in source_data: app.logger.info(f.id) counter +=

Firestore DeadlineExceeded exception for big collections

人盡茶涼 提交于 2021-01-18 04:35:44
问题 I'm trying to read bigger collections from Google Firestore for testing and archiving purposes. I'm hitting some interesting errors when I try to get all documents from collections with more than 6k documents in them. Naive Python solution My first try was using the Python google-cloud-firestore (version 0.30.0) library. source_client = firestore.Client() source = source_client.collection(collection) source_data = source.get() counter = 0 for f in source_data: app.logger.info(f.id) counter +=

Firestore DeadlineExceeded exception for big collections

寵の児 提交于 2021-01-18 04:28:22
问题 I'm trying to read bigger collections from Google Firestore for testing and archiving purposes. I'm hitting some interesting errors when I try to get all documents from collections with more than 6k documents in them. Naive Python solution My first try was using the Python google-cloud-firestore (version 0.30.0) library. source_client = firestore.Client() source = source_client.collection(collection) source_data = source.get() counter = 0 for f in source_data: app.logger.info(f.id) counter +=

Firestore DeadlineExceeded exception for big collections

醉酒当歌 提交于 2021-01-18 04:27:26
问题 I'm trying to read bigger collections from Google Firestore for testing and archiving purposes. I'm hitting some interesting errors when I try to get all documents from collections with more than 6k documents in them. Naive Python solution My first try was using the Python google-cloud-firestore (version 0.30.0) library. source_client = firestore.Client() source = source_client.collection(collection) source_data = source.get() counter = 0 for f in source_data: app.logger.info(f.id) counter +=