Do I understand MongoDB Realm correctly?

Iskeraet picture Iskeraet · Jun 11, 2020 · Viewed 7.9k times · Source

There are three components:

  • Realm Database: Local Storage & Persistence
  • Realm Sync: Sync Realm Databases between clients and the Mongo DB Atlas
  • Mongo DB Atlas: A Cloud Database.

You can use each separately or together. So you can

  • Just store data locally with Realm Database and not sync it
  • Just store data on Mongo DB Atlas without using realm sync, using standard queries to access the data.
  • Use realm sync to create a synced realm that partitions your mongo db atlas database into a local realm and syncs data between the database and all clients who use it.

Is this all correct? (Thank you)

Answer

tommy2712 picture tommy2712 · Jun 21, 2020

below are some notes for your questions. I'm just getting setup with MongoDB and Realm, myself.


A - Tools

Realm Database: Local Storage & Persistence

Correct - Client (on-device / local) storage

Realm Sync: Sync Realm Databases between clients and the Mongo DB Atlas

Somewhat confusingly, there's 2 different implementations of Realm Sync:

  1. Realm Sync - Syncs between clients with Realm (no MongoDB implementation necessary). This uses Realm-run database which costs $30/month
  2. MongoDB Realm with Sync - Syncs between Realm clients and MongoDB + Atlas backend which has a 'free forever' sandbox tier.

Mongo DB Atlas: A Cloud Database.

Correct - A database cluster + UI that is used in most tutorials to setup data models & database configuration.


B - Setups

Based on those understandings, you're correct that these tools can be used differently to have each of these setups. For instance...

Just store data locally with Realm Database and not sync it

Just normal old Realm for whatever client you need

Just store data on Mongo DB Atlas without using realm sync, using standard queries to access the data.

Any cloud MongoDB database provider. Atlas is the UI that sets up a database cluster, which you can connect to like any other via MongoDB Compass, etc.

Use realm sync to create a synced realm that partitions your mongo db atlas database into a local realm and syncs data between the database and all clients who use it.

MongoDB Realm with Sync (#2 above). For this, I've found the Task Tracker tutorial most helpful.

Hope that helps!