MongoDB Sync Connector

Bi-directional Data Sync with MongoDB - on-premise and to the cloud

ObjectBox Data Sync syncs data with MongoDB using the integrated MongoDB Sync Connector. Changes made on ObjectBox clients are synchronized in real-time to MongoDB and vice versa.

Use MongoDB as your backend and ObjectBox as your superfast local database.

Bi-directional Synchronization with MongoDB

Architecture: MongoDB <--> ObjectBox Sync Server <--> ObjectBox Sync Client
ObjectBox Sync Connector for MongoDB: Architecture

ObjectBox Sync brings your data in MongoDB to the edge (e.g. mobile and IoT devices, big and small servers) and synchronizes changes back to MongoDB. By using ObjectBox Sync, you can make your MongoDB data always available: continue to work offline and sync in real-time when online.

Migrating from Realm

If you are coming from Atlas Device Sync, you already know that it reached its official end-of-life on September 30, 2025, and maybe you got an extension to a later date. In any case, it's a good idea to get started with migrating from Realm to ObjectBox asap. Like Realm, ObjectBox has a deep integration with the programming language allowing you to work on (persistent) objects directly; no SQL required.

Production ready

The ObjectBox MongoDB Sync Connector reached GA status in October 2025. It is already being successfully used with large datasets and complex data models.

Understanding ObjectBox and MongoDB

ObjectBox and MongoDB have many similarities. Nevertheless, it's important to understand some differences in terminology and concepts between the two databases. The following table illustrates these differences. It serves as background information on how to map things between the two systems:

Concept
ObjectBox
MongoDB

Database containing the data

A store, grouped into types (data classes).

A database, grouped into collections.

What your application "opens"

Using a name or directory a single store (database) is opened locally on device. (In the case of Sync, this is the "client database".) Multiple stores can be opened, which are strictly separate.

A client is used to connect to a MongoDB server. All databases can be accessed on the server remotely.

Arranging data in a database (e.g. data sets)

A box holds all objects of the same type. A type typically matches a data class in programming languages. It's part of a strict schema (data model) that is enforced. The type definition consists of a fixed set of properties.

Collections are used to group documents together. By default, no strict rules are imposed (schema-less).

Data record

An object is an instance of a type. It can have data values for the properties defined in the type.

A document is a set of data values called fields. It's very similar to a JSON file.

Modelling related data

Objects can have to-one and to-many relationships to other objects. Relationships are bidirectional. Data is typically normalized.

Typically, a document embeds all "related data" into itself resulting in larger documents. Data is typically not normalized. Alternatively, one can also choose to use references, which is more similar to relationships.

Many-to-many relationships

Fully supported. Unlike to-one relationships, the data is stored outside the object. Updating relations is very efficient. There's no user-defined order and no duplicates.

Alternative modelling by embedding or referencing documents. Inside the document, you can have an array of IDs in a user-defined order allowing duplicates.

Nested data records

Nested data is supported by flex properties. E.g. these allow maps, which can contain nested data structures (JSON-like).

Documents contain nested data by default.

Identifiers (IDs)

IDs are 64-bit integers. They are unique within its box and database instance.

MongoDB uses Object ID (short: OID; 12 bytes) by default and supports other ID types. OIDs are unique within their collection and likely globally unique.

Next Steps

  • Setup a MongoDB instance, either locally or in the cloud.

  • Setup an ObjectBox Server instance and configure the MongoDB Sync Connector.

  • Import data from MongoDB to ObjectBox initially.

  • Now, two-way data synchronization between MongoDB and ObjectBox automatically happens.

Last updated

Was this helpful?