
Awesome Firebase Ideas for 2023
5 min read
Firestore finally gave us the count function last year. This opens up a plethora of ideas that I think the Firebase Team could implement in their core codebase. I also have some ideas that may be a bit more complex. Let's start simple:
1. Offset
It would be incredibly easy to add the offset()
directive now that they have the count()
function. This could probably be implemented, tested, and launched within a week. This would add the ability to do better pagination, skip queries based on number, better chats, forums, etc. This is a no-brainer to me.
2. Automatic Reference Aggregations
After seeing how easy the TTL Policy works, it would be cool to see the same thing work with reference types. Imagine having the reference type do automatic aggregations.
Now you simply select the collection you want to trigger, along with the reference field in that collection. Now, whenever that reference field's target gets updated, it will automatically be added to the document as an aggregation.
So, for example, an author reference field in a posts
document could be automatically aggregated so that that posts document always contains the up-to-date author
document inside the posts document. This basically simulates inner joins for documents.
Perhaps under-the-hood, it would need to create an onWrite on the posts
collection for creating the original document reference, as well as on onWrite on the users collection to update the document reference aggregation for when a user update's their data. However, having safer automatic functions would be better.
This also would need to cover cases where documents reference documents that also reference documents.
Advanced
There is another case, particularly for many-to-many cases or the Follower Feed, where you may want to copy entire documents to other places. Imagine having a posts
collection, and you want to copy each document many times to a users/{userID}/followers
collection. I'm sure this could be handled with some more complicated drop downs to automatic this more complex aggregation as well. This could be maybe 2024 or later.
3. Internal Searching
I think Firebase should just use another database under-the-hood to allow text searching instead of Algolia. This is probably the second most requested feature. You can read about my search version.
I have many ideas, but I can keep this post simple. Firestore now covers most use cases for counters, but it needs a way to create aggregations automatically, and not worry about Firebase Function time-outs. It also needs a basic offset and full text search capabilities. Then, and only then, would Firestore be a real competitor to MongoDB.
I'm excited to see what the team comes up with, as long as they keep innovating with new features for Firestore.
J