google-cloud-firestore

TypeError: snapshot.forEach is not a function

点点圈 提交于 2021-01-05 11:34:42
问题 I am new to nodejs and Google Cloud FireStore. So here is my code. createNewPage = function (title, header, content, db ) { let pageRef = db.collection("pages").doc(title.trim()); let setPage = pageRef.set({ title: title, header: header, content: content }); return pageRef; } const printPage = function(Page) { Page.get().then(snapshot => { if (snapshot.empty){ console.log("No matching documents"); return; } snapshot.forEach(doc => { console.log(doc.id, '=>',doc.data()) }) }) .catch(err => {

Firestore - Deep Queries

老子叫甜甜 提交于 2021-01-05 11:22:41
问题 I have a Firestore that contains a collection (Items) that contains subcollections (called "things"). When I get my Items collection I get all of the child documents but none of the child collections. I would like to do a deep retrieval, one object called Items that contains the sub-collections. I understand this is not possible out of the box, but I am struggling to write the code myself to do this. Can anyone help? constructor(public afs: AngularFirestore) { //this.items = this.afs

Firestore - Deep Queries

本秂侑毒 提交于 2021-01-05 11:20:33
问题 I have a Firestore that contains a collection (Items) that contains subcollections (called "things"). When I get my Items collection I get all of the child documents but none of the child collections. I would like to do a deep retrieval, one object called Items that contains the sub-collections. I understand this is not possible out of the box, but I am struggling to write the code myself to do this. Can anyone help? constructor(public afs: AngularFirestore) { //this.items = this.afs

Firestore - Deep Queries

邮差的信 提交于 2021-01-05 11:20:00
问题 I have a Firestore that contains a collection (Items) that contains subcollections (called "things"). When I get my Items collection I get all of the child documents but none of the child collections. I would like to do a deep retrieval, one object called Items that contains the sub-collections. I understand this is not possible out of the box, but I am struggling to write the code myself to do this. Can anyone help? constructor(public afs: AngularFirestore) { //this.items = this.afs

Are Firestore ids unique across the whole db [duplicate]

北城余情 提交于 2021-01-05 07:26:26
问题 This question already has an answer here : Firestore: Are ids unique in the collection or globally? (1 answer) Closed 1 year ago . What i mean- if we collect all the ids(auto-generated) from the all collections and sub-collections and etc. Will all of them unique? What for? I'am building a new feature, where users can share their items from sub-collections, so I am not sure - can I use same id between users sub-collections. Thanks! 回答1: Firestore document IDs must be unique within the same

Are Firestore ids unique across the whole db [duplicate]

杀马特。学长 韩版系。学妹 提交于 2021-01-05 07:25:05
问题 This question already has an answer here : Firestore: Are ids unique in the collection or globally? (1 answer) Closed 1 year ago . What i mean- if we collect all the ids(auto-generated) from the all collections and sub-collections and etc. Will all of them unique? What for? I'am building a new feature, where users can share their items from sub-collections, so I am not sure - can I use same id between users sub-collections. Thanks! 回答1: Firestore document IDs must be unique within the same

How to restict timely manner update document in Firestore database with poor network connections

一曲冷凌霜 提交于 2021-01-05 07:00:25
问题 I've create android application in which we used Firestore database. I want to update firebase document within time. Firestore is quick to post on server but when there is any connection issue then it taking time to save on Firestore My task is if User tried to update withing few seconds eg 20 seconds if user can't post that data on server withing 20 seconds then later on that update should not be post on server If user is online and have good connection then there is no problem but if there

How to restict timely manner update document in Firestore database with poor network connections

不想你离开。 提交于 2021-01-05 07:00:06
问题 I've create android application in which we used Firestore database. I want to update firebase document within time. Firestore is quick to post on server but when there is any connection issue then it taking time to save on Firestore My task is if User tried to update withing few seconds eg 20 seconds if user can't post that data on server withing 20 seconds then later on that update should not be post on server If user is online and have good connection then there is no problem but if there

Update a map field in all documents in Firestore

主宰稳场 提交于 2021-01-05 05:42:45
问题 I'm doing a web application in Angular 6 and the library angularfire2. I have two collections, teams and users . If a team's name is changed, the team's name must also be changed inside of the user's document. export interface User { firstName: string; emailAddress: string; team: TeamId; } export interface UserId extends User { id: string; } export interface Team { name: string; abbreviation?: string; } export interface TeamId extends Team { id: string; } Class: const team: Team = { name:

Firestore query where map contains string

淺唱寂寞╮ 提交于 2021-01-04 12:41:13
问题 Data structure: houses (collection) name (string) users (map) 90c234jc23 (map) percentage: 100% (string/number) Rules: allow read: request.auth.uid in resource.data.users; The problem is when I try to query houses which user owns: FirebaseFirestore.getInstance().collection(House.COLLECTION) // .whereArrayContains(House.USERS_FIELD, currentUser.getUid()) // does not work .whereEqualTo("users." + currentUser.getUid(), currentUser.getUid()) // does not work either .get() No result are returned.