Storing Images/Data outside of Device Sync

Hi,
In our solution we are considering storing files and images outside of our database (we’re on device sync) in order to save on costs. Is there some cloud functions that could support clean up operations of such action? or should I handle it only on client side.

Thanks!

Hello @donuts542 ,

Do you mind elaborating on the use case here? Are you asking about how to manage the images/files on the device, or are you asking about how to manage images/files in the cloud? Device Sync currently does not support binary data transfer to cloud providers as a built-in feature, but we have plans to add support in the future.

The way we currently recommend people to approach syncing binary data is:

  1. Instead of syncing the binary to MongoDB via Device Sync, in the application code, upload the binary to a dedicated blob storage provider (eg. S3, Google Cloud Storage, etc.)
  2. Once the binary file is uploaded to a blob storage provider, write the URL of the uploaded binary to the Realm object. ie. sync on the URL of the binary, not the binary data itself

For reference, an engineer on the team has built a nice extension library for the .NET SDK to transparently allow for binary uploads to cloud storage providers while syncing the URL to the Realm object. If you are developing on the .NET SDK, you may consider using this! Or if you’re using another SDK, you can use that extension as a reference point in how to achieve binary uploads in conjunction with using Device Sync.

Let me know if that helps,
Jonathan

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.