Pagination of data in Flutter with Firebase - firebase

I'm writing an app with a database of users. I want to show these to people on the app, and as such, in order to limit the download of data, I'm using the standard Firebase pagination concept:
.startAtDocument(lastDocumentSeen)
The problem is, I have no idea what actually happens when the 'read head' gets to the end of the database? Does Firebase/Flutter loop back and start to look at the top of the database again? If not, how does it signal to me that I've reached the end?
I've done quite extensive googling about this, and searched StackOverflow too, but can't seem to find any clear answers - does anyone know?

Assuming you have a query like this:
collectionRef.orderBy("something").startAfter(cursor).limit(10)
If there are not enough documents to return 10 results, Firestore will simply return however many documents are left. It does not perform any tricks beyond that.

You can use fetch_more package for pagination, it’s easy to use. You can see an example in the Example tab.
https://pub.dev/packages/fetch_more

Related

Automate Document Checks

this is sort of a weird/complicated question but I thought id ask.
So during the sign up process for my app (I am using flutter and firebase for backend), people have to submit certain documents such as a resume and other official documents. My question was assuming the documents have a standard layout, is there any way to verify that it is the correct type of document automatically? So someone couldn't fake a document and sign up for the app.
I wanted to make it in a way so I wouldn't personally have to go through each document and make sure its the right one.
If anyone has any ideas please ping me and let me know.
Thanks!

Firebase Web - Getting UID's from other users

I'm trying to use the "orderByChild" functionality provided by Firebase, but I stumbled upon a roadblock. The structure of my database is very simple, it looks a bit like this:
Root
Users
${UID}
ID
Name
Birthday
...
Now, I'd like to search other user's names without knowing their UID.
Does anyone have an idea on how to solve this problem?
I could just download the users file completely but that does not seem like a good idea.
this about the question before posting it on stack overflow : you have to make a strategy to get this issue solved , I propose to you two possible solutions :
1)(very bad solution):
you parse the data from firebase and you put them in [<String , anyObject>] and you loop over this array in order to get the username that you want to get.
**
Ps: in term of performance and usability the worst thing that you
could do is to invoke the database to get unuseful data, so don't use
this solution in production.
**
2) you make a strategy for this:
look over what should be the relationship between a user and another and add new field for example friends and store on it the uids that you want to get.

Firebase Testing Data

We've been using Firebase for the past 7-8 months now.
It has been a really awesome tool, and thanks for the effort.
Here I have a question regarding whether there is a way to modify the data without actually writing to DB.
Cause most often when we debug something we always write to our live db, then we have to delete them manually. You can image how painful it is.
So is there like a test db where we can write stuff without worrying about modifying the db?
I can just export the whole db every time I want to write something, then import it back once I'm done. But it is a rather tedious procedure. And what if I am doing something to auth which there is no way to export users data at the moment.
The Firebase blog has a nice article about End-to-end Testing with firebase-server. This may be the solution for you.

Performance of large collection in Meteor 1.0.X

There has been a LOT of development in the Meteor world, and as such it's getting hard to find answers that work for current versions due to the plethora of answers you find for old, out-dated versions.
I have an app that has a LOT of data in a particular collection. By lots I mean somewhere between 10k-100k, and very potentially a lot more. Essentially it's log data, and I need to display the results in a table with no pagination (like a tail). In researching ways to optimize large collections I keep running into things like this that seem to be for older versions of Meteor.
So, as I see it my options are:
Use fast-render plugin to display the page prior to the subscription (at least this is my understand on how it works).
Use some sort of progressive publish function, where it loads limited more relevant bits of data first, then progressively loads the remaining data by expanding the window/limit (not sure if this would cause heavier load on the server, though). There seems to have been a "progressive publish" plugin, but it doesn't seem to be under active development any longer.
Optimize the lookups via indexing (How do you specify that when creating the collection???)
Profiling and optimizing the template further (not sure how).
Some other method I haven't thought of yet...
Some combination of all-the-above.
What is the proper approach by which to publish and render lots of data in this way?
I'm going to assume that "optimize" means reduced query time.
Always start with the biggest bang for your buck.
Unless you're publishing the entire collection, or query on the _id, then you want to create an index using _ensureIndex. Get more info on this on the mongodb website or by searching other questions. http://docs.mongodb.org/manual/reference/method/db.collection.ensureIndex/
Second, limit the fields to just the info you need. eg {fields: {a:1, b:1}}. http://docs.meteor.com/#/full/fieldspecifiers
Third, don't sort.
If this still isn't good enough, make another question with schema & query details & the desired UI so we can better understand the reactivity and why you can't use some form of pagination.

Drupal 6 - Flag friend module - filtering friended users (or similar)

I'm using the flag friend module, and I'm trying to accomplish what I thought would be an easy task.
Basically I'm trying to achieve some variation of 'Show all site users in a view, but indicate which ones are the current logged-in user's friends'. Should be easy I would have thought, but I've spent all day on this and it ain't working. :(
A related option I've tried is to actually filter out the friended users, but I can't get that to work either.
I'm feeling like this question should be more comprehensive, so apologies if that's the case!
This solution isn't elegant, but it'd work...
You can get a set of user objects by using the flag_friend_get_friends function and use that to identify friendly users from the view's template.
If you'd prefer get just the friend uids you can query the table directly using
db_query('SELECT f.friend_uid FROM {flag_friend} f WHERE f.uid = %d', $user->uid)
I'm not super happy with these, but they will work for you.
Hope someone else comes up with something better.

Resources