Skip to content
Advertisement

Tag: google-cloud-firestore

Iterating collection and trying to get reference field inside documents .get() is not working

I am trying to get a collection then iterating over its documents. inside every document there’s a reference field for another collection document. Normally if i query for it then there is no problem but iterating creates a problem Following the field i want to get while iterating over organization-members However if i hard query then it works okay There

Change fields of documents in a collection Firestore periodically – Cloud Functions

I have a database structure like this: Posts(collection) -> userID (document) -> Subposts (subcollection) -> document[isVisible: true] We have different userIDs which means that each userID has a subcollection of different posts. I want to set up a cloud function which periodically (every 2 minutes) checks all the documents in all the sub collections (Subposts) and if the field isVisible

How to print Firestore timestamp as formatted date and time like December 28,2020 at 3:52:04 AM UTC+5:30?

while fetching date from firestore I am getting Timestamp “seconds: 1608490949, nanoseconds: 275000000”.I want to print it as properly formatted date and time. As it is “December 28,2020 at 3:52:04 AM UTC+5:30”. Below is my pic of code Answer You can call javascript date functions here because this converting into javascript date https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toString Or for more control on formatting, you

Advertisement