52

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)

6
  • That is correct. Realm Sync is still in beta though. I would not recommend building it into your production systems just yet. The local MongoDB Realm database is a very mature product as is MongoDB Atlas. Jun 11, 2020 at 11:12
  • Can you please give me the advice about handling shared data in realm. I mean what should be my partition key in this scenario.
    – Abdul Moiz
    Aug 3, 2020 at 21:49
  • As I read in the documentation we can only have one partition key at a time for any document.
    – Abdul Moiz
    Aug 3, 2020 at 21:54
  • 1
    Partitions are the worst part of MDB Realm. Yes, you can only have 1 key per document. That means no shared realms between documents. For a Proof of Concept you can use a single partition for all documents, which is a workaround. I would not use MDB Realm for production until they have solved this issue.
    – Iskeraet
    Aug 4, 2020 at 23:31
  • Can you host a realm server locally or do you need Atlas? Sep 10, 2020 at 23:53

3 Answers 3

25

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!

7

MongoDB Realm is basically the cloud application synchronization piece the connects a MongoDB Atlas database to client side realm data. The schema provides the mapping between these two entities. MongoDB Realm also provides an application with a universe of users who can access this cloud data. How users are authenticated into a MongoDB Realm application is determined by the providers the developer has defined.

2
  • 1
    does realm only work with atlas? or is it possible to use standalone mongodb community version running on my mac? Jun 9, 2022 at 0:43
  • Sync only works with Atlas. Realm prior to acquisition had a different sync server which you will still see referred to in old blog posts, prior to 2019. That server allowed you to run local instances but it was a commercial failure & was never open-sourced.
    – Andy Dent
    Nov 22, 2022 at 7:32
2

MongoDB Realm Definition: Well if you see in the MongoDB Realm docs you will see -

MongoDB Realm is a serverless platform and mobile database. MongoDB Stitch and Realm Database are now part of MongoDB Realm.

And also MongoDB Realm is a set of whole Bunch of Features:

  • Users & Authentication

  • MongoDB Data Access

  • Sync

  • GraphQL API

  • Functions

  • Triggers

  • Services

  • Static Hosting

  • Values & Secrets

  • Application Management

    So, I think, that's what MongoDB Realm is

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.