Firebase - Query against array values - ios

I have an array with usernames and would like to query that again the available users in the database and get their details (age, number, address, etc.).
How to do that in Firebase using Swift? I was thinking of doing a for loop and within it I could append to array of type Users, but doesn't that mean that number of requests made to Firebase will equal to number of users in the array? That can't be the way to go...
Thanks,

Related

Firestore query passing in an array of String - Firestore - Swift

I have an array of UIDs (String) and I want to perform a query using Firestore where I get all the documents in which the field "uid" is equal to any of the ones in the array provided.
Till now I tried doing:
ref.whereField("uid", in: uidArray)
But this doesn't work and gives me an error because the maximum number of elements in the array must be 10 and it surely surpasses that limit.
My question is: how can I achieve the same result with a workaround using Firestore?
Whenever I try to implement a query using this DB it seems it's built for making developers' lives harder.
Yes, according to the docs, the maximum number of elements in the array is 10. To be able to get over this limitation, you should perform successive calls. For example, if you need to check a field against 35 values, then you should perform 4 queries. Three queries with the 10 elements and the fourth with 5 elements. Lastly, you should combine the result on the client.

Filter GetRows on GoogleSheet Document via Logic Apps

I am reading from a google sheet of 100,000+ records but I want to load only the records after a certain date. ( so applying filter ) . But I haven't been able to accomplish that as I do not know how to access the column name without using foreach.
Here is what the data looks like from the googlesheet
So basically, I would like to filter the records something like this.
Timestamp ge '10/13/2021' so it will only return records for 10/13/2021 and 10/14/2021... etc.
Is this possible to do that? If not, what is the best recommended way to approach this issue as i just wanted to load daily records to sql db in the next step.
The Get rows action of the Google Sheets connector doesn't support filtering. You can only specify how many rows you want returned, and how many rows you want to skip. E.g. if you have 100,000 rows in your sheet, you can easily get the rows between 90,001 and 90,200, should you wish to do so.
While you can't use this connector to retrieve filtered data from Google Sheets, you can use the Filter array action to filter the retrieved data as you wish.
You might still need to use the For each loop to retrieve and filter data in chunks.

Generate a flutter list from a Cloud Firestore query

I am trying to generate a list containing the 'name' parameters as Strings from this Firestore.instance.collection('videos').limit(10).snapshots(); query, but I am having trouble extracting the parameter values from the documents and returning them as a list. Would I have to use .forEach() or do I have to .map() the entries to a list? Any help would be highly appreciated!
Edit: Additionally I would like to query the documents in a certain range, but .startAt() does not seem to accept integers. Is there any way to query say the first 10 documents by using Firestore.instance.collection('videos').startAt(0).limit(10).snapshots();?
There is an example of doing this using a StreamBuilder at https://pub.dartlang.org/packages/cloud_firestore#-example-tab-

query firebase database by ordering two values in iOS swift

I have a database of posts in firebase, and each has a timestamp and a rating.
i know how to order by time OR by rating, but would it be possible to order by rating, then limit by time. ie. show highest rated posts over the last week?
ie.
Ref.queryOrderedByChild("rating").observeSingleEventOfType(.Value, withBlock: {...}
would order by rating, but how would i then limit the query by time, and not rating?
Unfortunately, Firebase does not support cross referencing nor server-side logic, so you'll probably have to query by the more specific value, pull the data down, then sort the rest client side.
Alternatively, you could also try to get creative with GeoFire (firebase's cross referencing solution for latitude/longitude location querying), though that'll the hackiest solution ever...

Firebase get more data with queryLimitedToLast

I've a simple chat in swift and I retrieve 10 elements with queryLimitedToLast.
I want retrieve more element with a refresh function. How can increase the number of elements?
I've try to set the value in queryLimitedToLast with a variable but don't works.
Thanks!
Firebase Queries are immutable; once you've created them, you cannot modify them.
So you'll have to create a new query, which starts at the end of the previous query.

Resources