01:11 What it means when you go into offline mode? 01:45 Read data 04:30 Write data *Questions* 07:00 How large of a cache do we actually keep to store all that offline data? 08:33 Why are you seeing a lot of duplicate data calls? 09:55 What's up with the web, why isn't offline mode enabled by default? *Gotcha* 11:13 With document writes, the callback to a document doesn't get called until the write has actually been confirmed on the server. 12:14 Transactions will fail when you're offline. 12:42 On the cache right now, there are no indexes.
Success listeners for write operations not getting called while offline is indeed tricky. I'm glad I heard that here because I had some places where it broke my offline functionality.
Most people who searched for this video about billing, your answer is here: 13:15. Yesm we are devs, we think like this, and yes we would provide a bad user experience for the app to bill us less :)
This is so cool. I don't have to go and setup a local db, try and sync it with a server (so much work) ,and this works by default! Turned on flight mode and the magic happens.. and I did not even know about this feature.. Respect!
Not just the buffering part was nice, but the overall video is helpful. When the video was buffering(for real) for the second time, you got me there also.
The one thing about offline support is that it's much harder to debug (especially security rules). I've reverted to adding await() call so that errors are seen as exceptions otherwise I haven't found a way to see runtime errors in the debugger, they just silently fail
To avoid the "last write win" from the conflict resolution, you talked about security rules and cloud function.. I guess "transaction" can also do the work right ? I look forward your blog post on that.
My question would be can Firestore detect which data should be applied first after the offline data gets sync if the device's clock is incorrect when the offline data was stored on the device?
For get we have an option to fetch only from server. Why is it not possible to do the same for real-time onSnapshot listener? There are a couple of places where query is extremely slow for me because of caching and speed is way more important for me in those cases. Please add this option because I get a lot of complains regarding speed and it's not possible for me to disable caching because offline writes are very important for my app.
Really thank you!!! I wish there would be many mini-projects as examples for what you presented in Kotlin. As a beginner of Firestore, all 9 videos are too much information for me. I did try Friendly Eat Codelab, but got stucked at displaying data from Firestore.
I have a complex transaction with my database when it's offline, so I am using SQFLITE package, and I plan to use Firebase as an online database. If I create a sync method between these databases when there is internet connection, is it alright?
We have a Chat app (Android) developed based on firebase (Real time database) cloud. Currently chat history was coming only when we are in online, when we don't have internet it was showing blank. For getting the chat history in offline did we have develop any additional code in android app or simply we have to enable the offline mode option.
Is it a viable strategy to use Caching to reduce the amount of Reads? Im trying reduce the amount of reads by enforcing document reads from the cache instead of listening to valueChanges/get requests to the Server. So what im trying to do is, - i have a fieldValue that is called 'lastEdit': 'Server Timestamp' (Server Timestamp for consistency) in all my Documents. I first query all my *cache* documents that im about to read from the server, and get the latest Server Timestamp(cache) and give that value as a variable to the function that checks if there are any documents that have a higher lastEdit than the one in the cache, if yes then i get them, which should automatically update my query to the newest documents and only read the minimum of necessary documents. Im not really sure if this is viable so i would like to hear some opinions. (I suppose it is already automated (a feature of firestore - to only get what is needed) but its not working quite well on my side? For example: I have a collection with 10 Docs, i go to the side where the docs are loaded for the first time => 10 reads, i add a new doc => 1 read, because of subscription, now i to the same site but (a different window?) settings and then back to the now 11 Docs => 11 reads, (Im kind of expecting that it would only charge me for reads when i read them for the first time or there are some changes and not for everytime i visit the page... (too costy to host when it reaches the amount of 800 documents (default amount)))
Pending writes work only on delete() in my android app, calling set() doesnt do anything when I get back online. Can someone explain to me what should I do.
For me it the answer was to not use Firebase haha. Used Supabase with SQLite for the local instance. Been working flawlessly, it is just Postgres and not a document based db. @@axelpehl
One more question, in my Firebase database, I have a document of my customers who have purchased items from me. And in the document's fields, I have various maps of different items. Now all these maps have "price" as one of the fields (field in maps), If I want to total of price all items(which are in form of a map in 1 document, is it possible? If no, what's the alternative? NOTE:1) Kindly assume I can't save these items as separate documents 2) The map has many fields
So I'm developing an app with Flutter and Firebase, and I created a repository to manage local and remote data, and I'm using SharedPreferences to store data locally, and I created Streams to deliver local and remote data to the UI, and everytime I get some data from firestore I am saving it with SharedPreferences. And then I find this video. Are you telling me that firestore already does all of that automatically?
hi, can you plz explain caching and how can that reduce my read cost ?? i have my website which is hosted on firebase , but a lot of users are viewing my website not buying much, for that i need caching at server of all docs and providing users a specific list of Docs only. Thanks great job ..
I'm not expecting an answer, but will ask the question anyway in the hope I will. I'm making an app where I want data to be available online and offline. That means I will have to have database on the device as well. And if the user goes online, then data gets updated on the firestore server automatically and across connected devices. But this will include files such as images, possibly videos and strings. So do I need to create ROOM database and somehow synchronise it with firestore? Or there is a way I can Implement this with firestore? Thanks.
First of all I loved that buffering part honestly, and I thought it is my network :D Well I have a question, I have a document name "SeasonOne" and it has further sub documents "Episodes1,2,3....70" So each Episode has a title and Url. Well I have written a simple query and my persistent database is enabled. So whenever I will run the application is it going to make server call every time? I have internet enabled all the time. One more thing I want to clear that is I just fetch "SeasonOne" and it gives me list of sub-documents(episodes). Is it going to be counted 70+1 reads every time I open application? I have a terrible situation at the moment and I really wants the answer.
Great video! Please does this also work for images? Writing an image to the Firestore while offline, displays the "cached" image then uploads to the Firestore when there's connection. Is this possible?
*firebaser here* That's definitely possible, and would already work for images that you store in Firestore. I wouldn't recommend storing images there though as they'd count against your global cache size there, and honestly there are better places to store images. For example, storing the images in Cloud Storage will be much cheaper, and it also comes with a Firebase SDK. If you store the images there they won't be cached on devices by default, but there are great caching libraries for all platforms too. Also check out this video where Todd and Susan explain offline behavior and strategies for all Firebase products: ua-cam.com/video/XrltP8bOHT0/v-deo.html
If I am fetching the same document again and again and it has not changed, will it cost me a one read everytime? Or will it use the local cache. I am on Android
how do I disable offline mode on web? If I put one of those toggles for the user to choose if he/she wants or not to enable persistence, if this toggle is set to false, how do I turn the percistence off? is there a `disablePercistence()`?
How can I try this? Is there an example? lets say my code is let query = store.collection("products"); const querySnapshot = await query.get(); How can I use cache or reduce number of reads ?
At 5:45, ... says that the data is synced when the user gets back online. That's not neccesarily true. In my recent tests, the app needs to be open and, apparently, the there must be an socket open or something. Anyone has an exactly answer to this?
How long are offline write requests saved in cache? 6:33 what if user is offline for several days (>7) and performs a write on day 1, will it still be uploaded on the 7th day(when the user is back online)
Nothing is built in for that, but you can roll your own by adding a field to each document that says that it's finalized locked and then reject any further writes in security rules.
Really had me there with the buffering, almost contacted my ISP.
01:11 What it means when you go into offline mode?
01:45 Read data
04:30 Write data
*Questions*
07:00 How large of a cache do we actually keep to store all that offline data?
08:33 Why are you seeing a lot of duplicate data calls?
09:55 What's up with the web, why isn't offline mode enabled by default?
*Gotcha*
11:13 With document writes, the callback to a document doesn't get called until the write has actually been confirmed on the server.
12:14 Transactions will fail when you're offline.
12:42 On the cache right now, there are no indexes.
The buffering part was nice😂💪🏼
it tricked me successfully :D
Thank you
lol i think i lost my connection
Success listeners for write operations not getting called while offline is indeed tricky. I'm glad I heard that here because I had some places where it broke my offline functionality.
The best "documentation" on a library ever :)
Most people who searched for this video about billing, your answer is here: 13:15. Yesm we are devs, we think like this, and yes we would provide a bad user experience for the app to bill us less :)
Best intro ever in a tutorial video 😂
This is so cool. I don't have to go and setup a local db, try and sync it with a server (so much work) ,and this works by default! Turned on flight mode and the magic happens.. and I did not even know about this feature.. Respect!
Not just the buffering part was nice, but the overall video is helpful. When the video was buffering(for real) for the second time, you got me there also.
The buffering part was lit btw great content as usual
The one thing about offline support is that it's much harder to debug (especially security rules). I've reverted to adding await() call so that errors are seen as exceptions otherwise I haven't found a way to see runtime errors in the debugger, they just silently fail
incredible. there is no miracle, but this offline technology is close to heaven.
To avoid the "last write win" from the conflict resolution, you talked about security rules and cloud function.. I guess "transaction" can also do the work right ?
I look forward your blog post on that.
Transactions would just fail since data has to be up to date
Thanks a lot for a great playlist of lessons! Real pleasure to watch, listen and study
My question would be can Firestore detect which data should be applied first after the offline data gets sync if the device's clock is incorrect when the offline data was stored on the device?
This is absolutely hilarious... I wish all tutorials were like this
For get we have an option to fetch only from server. Why is it not possible to do the same for real-time onSnapshot listener? There are a couple of places where query is extremely slow for me because of caching and speed is way more important for me in those cases. Please add this option because I get a lot of complains regarding speed and it's not possible for me to disable caching because offline writes are very important for my app.
You are really good at your job.
Really thank you!!! I wish there would be many mini-projects as examples for what you presented in Kotlin. As a beginner of Firestore, all 9 videos are too much information for me. I did try Friendly Eat Codelab, but got stucked at displaying data from Firestore.
I have a complex transaction with my database when it's offline, so I am using SQFLITE package, and I plan to use Firebase as an online database. If I create a sync method between these databases when there is internet connection, is it alright?
Does a query against the cached data cost money?
No
I love the humor 😂
@@SimplifyUE true
Thank you guys 💚
Waiting for unity offline support. Intended to be supported?
We have a Chat app (Android) developed based on firebase (Real time database) cloud. Currently chat history was coming only when we are in online, when we don't have internet it was showing blank. For getting the chat history in offline did we have develop any additional code in android app or simply we have to enable the offline mode option.
Is it a viable strategy to use Caching to reduce the amount of Reads?
Im trying reduce the amount of reads by enforcing document reads from the cache instead of listening to valueChanges/get requests to the Server.
So what im trying to do is, - i have a fieldValue that is called 'lastEdit': 'Server Timestamp' (Server Timestamp for consistency) in all my Documents.
I first query all my *cache* documents that im about to read from the server, and get the latest Server Timestamp(cache) and give that value as a variable to the function that checks if there are any documents that have a higher lastEdit than the one in the cache, if yes then i get them, which should automatically update my query to the newest documents and only read the minimum of necessary documents.
Im not really sure if this is viable so i would like to hear some opinions.
(I suppose it is already automated (a feature of firestore - to only get what is needed) but its not working quite well on my side? For example: I have a collection with 10 Docs, i go to the side where the docs are loaded for the first time => 10 reads, i add a new doc => 1 read, because of subscription, now i to the same site but (a different window?) settings and then back to the now 11 Docs => 11 reads, (Im kind of expecting that it would only charge me for reads when i read them for the first time or there are some changes and not for everytime i visit the page... (too costy to host when it reaches the amount of 800 documents (default amount)))
Love the guy!💕 google please make interesting tutorials for us. That's true we have to watch these videos, but shouldn't have we fun!?😉
Pending writes work only on delete() in my android app, calling set() doesnt do anything when I get back online. Can someone explain to me what should I do.
Is this offline supported for Flutter Desktop apps? Specifically Windows?
This is exactly the Information i Need as well. Anyone got the answer to this?
For me it the answer was to not use Firebase haha. Used Supabase with SQLite for the local instance. Been working flawlessly, it is just Postgres and not a document based db. @@axelpehl
The entire series is so informative & funny :)
One more question, in my Firebase database, I have a document of my customers who have purchased items from me. And in the document's fields, I have various maps of different items. Now all these maps have "price" as one of the fields (field in maps), If I want to total of price all items(which are in form of a map in 1 document, is it possible?
If no, what's the alternative?
NOTE:1) Kindly assume I can't save these items as separate documents
2) The map has many fields
Aman Kataria store the total price in 1 separate property..
Does Cloud Storage have a similar offline persistence mechanism, or it's just available for Cloud Firestore?
So I'm developing an app with Flutter and Firebase, and I created a repository to manage local and remote data, and I'm using SharedPreferences to store data locally, and I created Streams to deliver local and remote data to the UI, and everytime I get some data from firestore I am saving it with SharedPreferences. And then I find this video. Are you telling me that firestore already does all of that automatically?
hi, can you plz explain caching and how can that reduce my read cost ?? i have my website which is hosted on firebase , but a lot of users are viewing my website not buying much, for that i need caching at server of all docs and providing users a specific list of Docs only. Thanks great job ..
Great video. Does Realtime Database provide similar "auto caching" and "fetch only on change" features? Or is it only possible with FireStore?
Same question. My app is new and I'm thinking if I should switch to Firestore
Really had me on the buffering part
👍👍
I'm not expecting an answer, but will ask the question anyway in the hope I will. I'm making an app where I want data to be available online and offline. That means I will have to have database on the device as well. And if the user goes online, then data gets updated on the firestore server automatically and across connected devices. But this will include files such as images, possibly videos and strings. So do I need to create ROOM database and somehow synchronise it with firestore? Or there is a way I can Implement this with firestore? Thanks.
First of all I loved that buffering part honestly, and I thought it is my network :D Well I have a question, I have a document name "SeasonOne" and it has further sub documents "Episodes1,2,3....70" So each Episode has a title and Url. Well I have written a simple query and my persistent database is enabled. So whenever I will run the application is it going to make server call every time? I have internet enabled all the time. One more thing I want to clear that is I just fetch "SeasonOne" and it gives me list of sub-documents(episodes). Is it going to be counted 70+1 reads every time I open application? I have a terrible situation at the moment and I really wants the answer.
I just needed content. But you gave me quality and entertainment
If the data online is the same as offline cached data, and we perform read operations, do we still cost for the reads?
Does this unlimited cache when writing also apply to the firebase realtime database?
Hey, how to cache a stream of videos from firestore and then retrieve them, so that the videos don't buffer in flutter. For an app like tiktok.
what about firebase cloud-storage offline support? My quick Google searches does not say anything about it.
@UCZ0SEPZzWkA2rSlxMfTUI_w awesome thank you!!!
Great video! Please does this also work for images? Writing an image to the Firestore while offline, displays the "cached" image then uploads to the Firestore when there's connection. Is this possible?
*firebaser here* That's definitely possible, and would already work for images that you store in Firestore. I wouldn't recommend storing images there though as they'd count against your global cache size there, and honestly there are better places to store images. For example, storing the images in Cloud Storage will be much cheaper, and it also comes with a Firebase SDK. If you store the images there they won't be cached on devices by default, but there are great caching libraries for all platforms too. Also check out this video where Todd and Susan explain offline behavior and strategies for all Firebase products: ua-cam.com/video/XrltP8bOHT0/v-deo.html
Is it possible upload data and read it while offline? I mean before conect to internet.
Love these videos. However, they're too fewer in quantity. Also, anybody tell you that you look like Robin Williams?
If I am fetching the same document again and again and it has not changed, will it cost me a one read everytime? Or will it use the local cache. I am on Android
I love that loading buffer joke!
how do I disable offline mode on web? If I put one of those toggles for the user to choose if he/she wants or not to enable persistence, if this toggle is set to false, how do I turn the percistence off? is there a `disablePercistence()`?
How can I try this? Is there an example? lets say my code is
let query = store.collection("products");
const querySnapshot = await query.get();
How can I use cache or reduce number of reads ?
Excellent video, with very interesting use cases !
Reads from the cache data are billied?
Thanks! Does it support react native with expo?
5:27: it generally takes a few thousand writes,
are you challenging me?
Could you please make how to connect firebase with swiftui 5.1?
At 5:45, ... says that the data is synced when the user gets back online. That's not neccesarily true. In my recent tests, the app needs to be open and, apparently, the there must be an socket open or something. Anyone has an exactly answer to this?
How long are offline write requests saved in cache? 6:33 what if user is offline for several days (>7) and performs a write on day 1, will it still be uploaded on the 7th day(when the user is back online)
I'm sure it will work
Thanks for Korean subtitle.
Cannot use import statement outside a module
import firebase from "firebase/compat/app";
import "firebase/compat/auth";
your documentation is not full. This video explain nothing. :/
Is there a way to lock a document? Say it marked completed the not more update can be done on it.
Nothing is built in for that, but you can roll your own by adding a field to each document that says that it's finalized locked and then reject any further writes in security rules.
Very well explained. Thank you!
LOL nice intro, I thought I lost connectivity there for a sec
Haha.. Love the intro!
Just liked the intro damn so creative
Does the same logic apply to the Realtime Database?
No
Reminder that there is a Firestore tutorial on my channel:
ua-cam.com/play/PLrnPJCHvNZuDrSqu-dKdDi3Q6nM-VUyxD.html
how to implement offline support for flutter?
Thanks for explanation of this issue
Great Video
Thanks!
You know it's gonna be a fun video when they break the 4th wall
Not link online payment system
"I'm sorry he needs to go on the plane with me. 💻 He is a licensed emotional support server" 🤣🤣😆
How to enable it for flutter?
Works on my flutter app by default. I have listview builders that bring up 100's of records from cache without having to do anything. Pretty cool!
Note, these were done with FutureBuilder returning a ListView.builder
him: "if you put your server in offline mode you have bigger problems"
me: cries in network partitions and CAP theorem
Finally!!!
Genius!
There is Indonesian
You got me good
"if you are putting your server on airplane mode, you might have bigger problems" 😂😂
awesome
the only worst thing of firebase is Vendor Lock :)
The buffering 😂😂😂
Watched this at a location with poor Wifi, totally fooled me xD
Imagine the life of a developer without firebase.
wow, the video lagged at the same time the rest of youtube wouldnt load
😁
lolz
The cartoon animation figures are not amusing ! They are only distraction in a technical presentation like this.
bhai tu thora dekisugi he kya?
Simple answer: You don't! 😝😝😝