- This repository illustrates how to write to a synced realm from both the renderer and main process.
The
main.jsfile is the Electron main process. Therenderer.jsis the Electron renderer process. To sync changes to a remote realm, open a synced realm on the main process using theRealm.open()syntax. Then open a non-synced realm on the renderer process using thenew Realm()syntax and setsync:trueon the configuration object. This will allow writes from the renderer process to be synced by the realm on the main process.
- Create a MongoDB Realm application and enable Realm Sync
- Replace the
"<Your App ID>"with your Realm app id inmain.js - npm install
- npm start