realm-studio
realm-studio copied to clipboard
Improve JSON exporting
Is your feature request related to a problem? Please describe.
The current solution for exporting to JSON uses the JSON.stringify
with a fallback to the Realm.JsonSerializationReplacer
which doesn't work well for highly branching data. This results in very large strings of JSON data, ultimately throwning errors such as "failed to export invalid string length".
Describe the solution you'd like
We could choose a single file, which is nice because users don't need to jougle multiple interdependent .json files. It doesn't however play nicely with the tools available to import data into a MongoDB server (mongodbimport and MongoDB Compass).
In order to facilitate a migration from the legacy Realm Cloud into MongoDB Atlas, we could implement exporting to a JSON format of multiple files (one per class). The format should ideally be new-line or "comma seperated" JSON files, making them compatible with the current tools available for importing (see https://docs.mongodb.com/compass/current/import-export/).
We could provide an option to generate _id
values for the to-be documents and use these for relationships between objects.
Describe alternatives you've considered
We could invest in implementing a CSV exporter instead.
Additional context
We're also tracking this issue: https://github.com/realm/realm-studio/issues/15 (since the age of times).