Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

463
Views
Realm with fully offline work (never online)

I'm trying to understand how every element of mongoDB works but I'm really confused about how the offline is handled.

Going to: https://realm.io/

I read this:

Realm’s mobile database is an open source, developer-friendly alternative to CoreData and SQLite. Start in minutes, port your app in hours, and save yourself weeks of work.

And then this part where it mentions the offline part:

Designed for Offline Use

Does this means that Realm can be used as a completely offline database in a mobile app?

if i understand correctly, this database would work similarly to Android Room where I store data using Objects/Documents.

Because when I go to the "Let's start" section, I'm being redirected to here:

https://docs.mongodb.com/realm/get-started/introduction-mobile/

Where I read this part:

Before you begin, you will need a MongoDB Atlas account. You can learn more about creating an Atlas account in the Atlas Getting Started documentation

So my first question: why I need an Atlas account? I understand that the Atlas is to have a MongoDB database in the cloud. Why I need this if I want to work with a offline database?

I guess that the tutorial want to show all the tools working together. So maybe that step can be skipped. But then going to the React Native Tutorial, I see this part:

https://docs.mongodb.com/realm/tutorial/react-native/#std-label-react-native-tutorial

Connect to Your MongoDB Realm App

To get the app working with your backend, you first need to instantiate the Realm app. The Realm app is the interface to the MongoDB Realm backend. Navigate to the getRealmApp.js file and complete the getRealmApp()

This part of code seems really important:

// Returns the shared instance of the Realm app.
export function getRealmApp() {
  if (app === undefined) {
    const appId = "<your Realm app ID here>"; // Set Realm app ID here.
    const appConfig = {
      id: appId,
      timeout: 10000,
      app: {
        name: "default",
        version: "0",
      },
    };
    app = new Realm.App(appConfig);
  }
  return app;
}

the code is forcing me to indicate the AppId that I get in the Realm Console.

So my second question: How can make this part offline? Should I just skip the appId? Would this work?

Is this possible or Realm Is not really suited for completely offline work?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I'm really confused about how the offline is handled.

Realm is an offline first database and all data is stored locally in a file and then sync's to the server later if you're using MongoDB Realm Sync

Does this means that Realm can be used as a completely offline database in a mobile app?

For sure. Data is stored in a file as mentioned.

So my first question: why I need an Atlas account?

You don't need an Atlas account for offline use. You would need to set up an account to be able to access the MongoDB Realm Console and configure a Realm App for Sync'ing

This part of code seems really important:

The code in your question is used when you're using MongoDB Realm Sync. It's not needed for offline only use.

So my second question: How can make this part offline? Should I just skip the appId? Would this work?

You don't need that code for offline only use.

Is this possible or Realm Is not really suited for completely offline work?

It is well suited for offline only work and if you want to transition to an online model, it's well suited for that too.

If you want to use Realm offline only see the documentation Open a Local (Non-Synced) Realm which shows

To open a local (non-synced) realm, pass a Configuration() object to either Realm.open() or new Realm(). The following example creates a Configuration object with a path property that defines the local file path to store data.

const config = {
   schema: [schemas.TaskSchema, schemas.UserSchema, schemas.ProjectSchema],
   path: "./myrealm/data"
};
const realm = await Realm.open(config);

once you have the realm var, you can then work with realm locally:

// Query realm for all instances of the "Task" type.
const tasks = realm.objects("Task");
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!