I’m considering letting users follow other users in a app, and would have a feed of posts from people who they follow. Is there a way to query multiple ‘where’ statements at once, or compare to a List? Or would a alternate route need to be taken? Here is a example scenario in NodeJS: (.Any() is made up and what
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
accessing GeoPoint data from firestore document
I’m using react native and have firestore structured like this. and i want access the geopoint latitude and longitude. how do i do that? sorry i’m still newbie i’m getting error with this code Answer Firestore GeoPoint is not an array; it’s an object you can access the lat & long using their field names, like below
Firestore data not displaying in my flatlist?
I am trying to display the posts of whoever a user is following: First, I query firestore and get the list of all the users the current user is following For each user in “following”, I get their posts I order their posts by data created, using a javascript sort function Here is the code: The issue lies in setting
Paginating data causing unusual behavior?
I am displaying “global posts” on one of my tabs. Currently, there are only 11 posts in the database: In the app Some of the posts are being duplicated, and I have no idea why these SPECIFIC posts are being duplicated, as it seems to me like it is happening at random. Here is the code for how I paginate
problems with an array awaiting for a function that reads from firestore
I’m trying to build a method which reads from firestore an array of elements (object): I have a service which retrieves the data from firestore, first it gets an array of document references var data = snapshot.get(‘elements’); and then it gets all the objects: } Then in a component I have an async method which calls the service, and tries
React Native Firebase Array Query to do ArrayContains with AND operation
I have group collection. In each group document, I store which users are associated with the group via members array field in firebase. Eg: user1 & user2 are in xyz(id) group and I would like to query from client to get all the group where having user1 & user2 ( not OR ). I have tried firebase IN array query
Firestore is super slow to retrieve documents even though an index is created
I am having trouble with Firestore in production. There is a collection I am trying to query and it has about 200-300 documents. It’s a simple query being done through a Cloud Function. I’ve setup a timer to log the duration of each query. This one takes about 2-4 seconds This one takes another 2-3 seconds There might be something
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