Upload image to MongoDB Atlas using Realm (offline first method)


I wanna get the user information as input in android and upload the information to MongoDB Atlas how it will be possible please send me some tutorials or docs. my question is how to store images offline in the device and then sync later to Atlas when a connection happens with the server.

Realm is not a good solution for storing blob data. Images can be very large files so leveraging a solution that can handle that type of data is recommended.

We’ve be using Firebase Storage and it works very well for that purpose.

If the images are small, like thumbnails, Realm can be used for those.

Its single user image around 100kb - 2mb . We cant upload image when user is offline .

Well, that would be true. If you are offline it would be stored locally and not uploaded. Once the connection is reestablished, it will sync automatically. Do you have some code you’ve tried that you need help with?

Did you check out the getting started guide as there’s an abundance of information about storing data in Realm. There’s also a tutorial for Getting Started With Sync you may want to take a look at after your comfortable with the basics.

I am looking for sample for image upload if you have any GitHub repo please share with me

If your image sizes are 2mb, Realm (as mentioned above) is not a good solution for image storage. If they are 100k then that would be ok but anything much larger is not recommended.