google-cloud-firestore

Failure to Deploy Cloud Function When Using Wildcard in Trigger

杀马特。学长 韩版系。学妹 提交于 2020-06-17 08:57:04
问题 I'm trying to deploy a cloud function that will trigger whenever a document is added to a particular collection as below: const admin = require("firebase-admin"); const functions = require("firebase-functions"); const Firestore = require("@google-cloud/firestore"); const firestore = new Firestore({ projectId: config.projectId }); admin.initializeApp(config); exports.checkCapacity = functions.firestore.document("gran_canaria/las_palmas_1/miller_pendientes/{albnum}") .onCreate(async (snapshot,

How to add Document with Custom ID to Firebase (Firestore) on Swift

余生长醉 提交于 2020-06-17 04:34:07
问题 Is there any way to add a document to firestore collection with custom id on Swift Language, not the id generated by firestore engine. Thanks in advance for your responses. 回答1: Yes. Just try this: Firestore.firestore().collection("items").document("yourId").setData(["item": "test"]) 回答2: 2020 Usually you'd want the error handling: Firestore.firestore() .collection("companyAddress") .document(companyID) .setData([ "address1": a1, "address2": a2, "city": c ]) { [weak self] err in guard let

Can I populate the data from Firestore to Google Sheet whenever a new record is added using a Cloud Function?

非 Y 不嫁゛ 提交于 2020-06-17 03:16:22
问题 I am trying to build this app where I am planning to store my data in a Firestore database. My client needs the data in a Google Sheet. Can I use Cloud Function to directly populate the records from Firestore to a Google Sheet and whenever a new record will be added to the Firestore, Google Sheet will be updated automatically? Can anybody suggest any resource that can help on this topic? 回答1: Yes, you can use cloud function with Firestore trigger that is notified when your firestore document

How to properly structure localized content in Cloud Firestore?

北城余情 提交于 2020-06-17 02:59:25
问题 I'm thinking about migrating to Cloud Firestore from realtime ratabase and wondering how I can properly setup the datastructure for my localized content. This is how it was structured in RTDB: articles en-US article_01 de-DE article_01 In Firestore, would I create something like this? Collection: articles document: article_01 And then nest all the data of article_01 in two maps called 'en-US' and 'de-DE'? Not sure if there's not a better way to structure localized data in Firestore? Thanks

How to properly structure localized content in Cloud Firestore?

≡放荡痞女 提交于 2020-06-17 02:59:08
问题 I'm thinking about migrating to Cloud Firestore from realtime ratabase and wondering how I can properly setup the datastructure for my localized content. This is how it was structured in RTDB: articles en-US article_01 de-DE article_01 In Firestore, would I create something like this? Collection: articles document: article_01 And then nest all the data of article_01 in two maps called 'en-US' and 'de-DE'? Not sure if there's not a better way to structure localized data in Firestore? Thanks

Firebase get data by timestamp

空扰寡人 提交于 2020-06-17 00:05:55
问题 I need to filter data using to get specific data for the timestamp match. For example I need the data where arrivalTime matches with exact date and time fields, timestamp field in database. I am trying below but it returns no data. _arrivalTIme = moment( `${todaysDate.format('YYYY/MM/DD')} ${_arrivalTIme}:00`, ).toDate(); // _arrivalTIme: Thu May 28 2020 09:00:00 GMT-0600 (Mountain Daylight Time) return firestore() .collection('mainCol') .doc(todayDate) .collection('subCol') .where(

Firestore WhereIn Query with FieldPath.DocumentId is throwing exception

走远了吗. 提交于 2020-06-17 00:04:32
问题 Trying to fetch few documents from a Collection based on a list of DocumentIDs and not able to get the following working using WhereIn and FieldPath. Nuget version Google.Cloud.Firestore v1.1.0 public async Task<IEnumerable<T>> GetByDocumentIdWhereIn(IEnumerable<string> documentIds) { CollectionReference ref= FirestoreDb.Collection(_collectionName); Query query = ref.WhereIn(FieldPath.DocumentId, documentIds); QuerySnapshot querySnapshot = await query.GetSnapshotAsync(); ... } And I am

Flutter Firestore Error performing updateData, No Document found to update

天涯浪子 提交于 2020-06-16 23:46:46
问题 Im using Firestore for mu Flutter project. I cannot update a field in a document. It results in error (error performing update, No document found) Code: await Firestore.instance.collection('QuizProfile').document("20200528-KYUMI").updateData( { 'Slot': 'asdfg', }, ); } Error message :: E/flutter (18326): [ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: PlatformException(Error performing updateData, NOT_FOUND: No document to update: projects/fir-2d2f0/databases/(default)

Filter a collection group query in FireStore

岁酱吖の 提交于 2020-06-16 19:13:45
问题 I have a database structure as follows (simplified for purposes of this question): Collection: item_A -> Document: params = {someParameter: "value"} -> Document: user_01 -> Sub-collection: orders_item_A -> Document: order_AA = {type: "A1", address: {pincode: "000000", city:"Paris"} -> Document: order_AB = {type: "A2", address: {pincode: "111111", city:"London"} ... -> Document: user_02 -> Sub-collection: orders_item_A -> Document: order_AC = {type: "A1", address: {pincode: "222222", city:

Trying to set up Cloud Firestore security rules using request.path

偶尔善良 提交于 2020-06-16 19:09:22
问题 I am struggling to get my head around some Firestore security concepts. I want to set up a rule based on the request.path property. My rule is this: service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if request.path[0]=='appUsers'; } } } ...and I then use AngularFire2 to add a document like this... this.myAngularFirestore.doc('/appUsers/'+this.auth.auth.currentUser.uid).set({name: this.auth.auth.currentUser.displayName}) .then(()=