Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

One or more Realm files

We have are evaluating realm-js in Electron.Just local storage, no cloud sync. Out app is data is based on projects - a user may have one or more projects. When the user closes a project, all project data are deleted. One project may take about thousands of objects, a few MB of data. We are considering to use either one defaultPath realm file for all projects, or a separate realms files for all projects. (The app never needs to query data across projects.) Is there any recommendation?

With one Realm file, we hit a missing cascade delete in Realm. So, in case of any mistake in app, some objects may remain in DB if a project is deleted, and it would not be possible to find them (unless we add some key or tag which will be used just for this purpose).

On the other hand, when storing in a multiple Realm files, we may just delete the file and that’s all. On the other hand, multiple file management takes some overhead and we need some shared DB for a few shared data (like user name, email) anyway.

Thanks for advices