MongoDB Atlas Device SDK
Parent: MongoDB Atlas · Published reference · snapshot 2026-09-08 · skill mongodb-atlas-expert/references/mongodb-atlas-device-sdk.md
↓ Facts as markdownall context files
> DEPRECATION NOTICE — Critical Context for All Readers
These notes link each claim to its source. Some citations identify archived research reports that are no longer hosted on this site. A published reference means the content is available; it does not certify independent review or accuracy.Read the editorial policy and follow the sources before relying on a claim.
MongoDB Atlas Device SDK & Edge Server
- > DEPRECATION NOTICE - Critical Context for All Readers > > On September 9, 2024, MongoDB announced the deprecation of Atlas Device Sync + Realm SDKs. The sync service (Atlas Device Sync) reached end-of-life on September 30, 2025. The local Realm database library continues as an open-source project, but SDK versions 20.x and later no longer support cloud synchronization. Users who need mobile-to-cloud sync must migrate to alternatives. > > This skill documents the final architecture of the system because: (1) existing apps built on Realm/Device Sync still run in production and require support, (2) the Realm local database (without sync) is still viable open-source, and (3) the underlying patterns inform alternative architectures. All guidance is explicitly labeled by EOL status. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#mongodb-atlas-device-sdk-edge-server]
When NOT to Use This Skill
- Do not use this skill to guide new greenfield project decisions. Atlas Device Sync reached end-of-life on September 30, 2025 and is permanently shut down. Use this skill for: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#when-not-to-use-this-skill]
- Supporting existing Realm/Device Sync production apps [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#when-not-to-use-this-skill]
- Advising on the EOL migration path for a current Realm customer [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#when-not-to-use-this-skill]
- Understanding the Realm local database (still viable open-source, sync-free) [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#when-not-to-use-this-skill]
- For new mobile sync architectures, redirect to alternatives: PowerSync, Couchbase Mobile, Ditto, or custom HTTP sync over Atlas. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#when-not-to-use-this-skill]
Overview
- MongoDB Atlas Device SDK was the official rebrand of the Realm SDK in 2023, completing the migration of Realm (acquired by MongoDB in 2019) into the Atlas platform family. The system comprised two layers: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#overview]
- Realm local database - an embedded, file-backed, reactive object store. Open-source (Apache 2.0). Continues to exist as a local database library without cloud sync. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#overview]
- Atlas Device Sync - a managed sync service inside Atlas App Services that bridged the on-device Realm to a MongoDB Atlas cluster via a binary WebSocket protocol. Shut down September 30, 2025. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#overview]
- Atlas Edge Server was a companion feature in public preview (May 2024) - a MongoDB process deployable at the edge (factory, retail, aircraft) that acted as an intermediate sync tier between device SDKs and Atlas. It was also deprecated before September 30, 2024. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#overview]
1. SDK Language Matrix
- MongoDB maintained official SDKs for seven language/platform targets: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#1-sdk-language-matrix]
- Package identifiers: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#1-sdk-language-matrix]
- Swift: RealmSwift (SPM: realm-swift), CocoaPods pod RealmSwift [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#1-sdk-language-matrix]
- Kotlin: io.realm.kotlin - library-base (local) + library-sync (Device Sync) [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#1-sdk-language-matrix]
- Java: io.realm:realm-android - Gradle plugin realm-android [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#1-sdk-language-matrix]
- JavaScript: npm realm (was realm@^12) [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#1-sdk-language-matrix]
- .NET: NuGet Realm + Realm.Fody [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#1-sdk-language-matrix]
- Flutter/Dart: pub.dev realm (v20.x current), realm_generator [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#1-sdk-language-matrix]
- C++: header-only via CPM/cmake [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#1-sdk-language-matrix]
- Version compatibility with Atlas App Services: Device Sync required Atlas App Services. The SDK connected to an App Services "application" identified by its App ID (e.g., myapp-abcde). The App Services endpoint was https://realm.mongodb.com with WebSocket sync over wss://ws.realm.mongodb.com. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#1-sdk-language-matrix]
2.1 Defining Objects
- Swift (@Persisted wrapper, SDK 10+): [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#21-defining-objects]
- Generate: dart run realm generate [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#21-defining-objects]
2.3 Primary Keys
- @PrimaryKey (Kotlin) / primaryKey: true in @Persisted (Swift) / @PrimaryKey() (Dart) [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#23-primary-keys]
- For Device Sync: field must be named _id [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#23-primary-keys]
- Primary keys are immutable once written to a synced realm [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#23-primary-keys]
2.5 Schema Migration
- Strategies: incremental block (production), deleteRealmIfMigrationNeeded (dev only), additive fields (no block needed). [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#25-schema-migration]
3. Atlas Device Sync — Flexible Sync
- > Status: EOL September 30, 2025. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#3-atlas-device-sync-flexible-sync]
3.3 Subscriptions
- Queryable fields must be declared in App Services UI - only top-level primitives, lists, sets eligible. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#33-subscriptions]
3.5 Offline-First Behavior
- Reads/writes succeed immediately against local Realm file [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#35-offline-first-behavior]
- Writes append to internal upload queue [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#35-offline-first-behavior]
- On reconnect: upload queue replayed to server, server changes replayed locally [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#35-offline-first-behavior]
- Conflicts resolved by sync engine before applying [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#35-offline-first-behavior]
- Automatic reconnection with exponential backoff [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#35-offline-first-behavior]
3.6 Asymmetric Sync (Data Ingest)
- Write-only mode for high-volume insert-only workloads (IoT telemetry, GPS, audit events). Objects are deleted from device after sync; cannot be queried/updated. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#36-asymmetric-sync-data-ingest]
4. Atlas Edge Server
- > Status: Deprecated before September 30, 2024. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#4-atlas-edge-server]
- Middle tier between Device SDK clients and Atlas for intermittent-WAN environments. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#4-atlas-edge-server]
- vs Direct Atlas Sync: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#4-atlas-edge-server]
- Deployment (Docker): [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#4-atlas-edge-server]
- SDK connection to Edge Server: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#4-atlas-edge-server]
- Admin API (port 27020): GET /api/edge/v1.0/info, GET /api/edge/v1.0/connection, POST /api/edge/v1.0/pause|resume [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#4-atlas-edge-server]
6. Authentication Providers
- Token management: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#6-authentication-providers]
- Access tokens expire after 30 minutes; SDK auto-refreshes using refresh token [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#6-authentication-providers]
- Refresh tokens expire after 60 days (configurable); user must re-authenticate on expiry [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#6-authentication-providers]
- Stored in browser localStorage/sessionStorage (Web SDK) or device secure keystore (mobile) [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#6-authentication-providers]
- Identity linking: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#6-authentication-providers]
7.1 Operational Transformation
- Uses OT (not CRDT). Last-write-wins for scalars by server timestamp. List operations preserve intent of both writes where possible. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#71-operational-transformation]
- Custom resolvers are not supported at field level. Influence conflict behavior via: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#71-operational-transformation]
- Asymmetric sync - no conflict possible (write-only) [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#71-operational-transformation]
- Embedded objects - parent subtree treated atomically [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#71-operational-transformation]
- Server-side Atlas Triggers - reactive post-sync reconciliation [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#71-operational-transformation]
- Schema design - append to lists rather than update indexes [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#71-operational-transformation]
7.3 Conflict Design Patterns
- Append to lists rather than update indexed positions [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#73-conflict-design-patterns]
- Use @MapTo (Java/legacy Kotlin) or @PersistedName (modern Kotlin SDK) for canonical Atlas field names [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#73-conflict-design-patterns]
- Prefer embedded objects for sub-documents (atomic parent update) [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#73-conflict-design-patterns]
- High-frequency telemetry → asymmetric sync (no conflict surface) [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#73-conflict-design-patterns]
8.1 Memory: Lazy Loading
- Realm objects are live, memory-mapped - zero-copy pointer arithmetic. Property access reads only accessed pages. Keep results as Results<T> / RealmResults<T> for UI binding; avoid materializing to Array/List unless serializing. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#81-memory-lazy-loading]
8.2 Transactions
- One realm.write {} = one ACID commit. Batch all related writes in a single transaction: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#82-transactions]
8.3 Thread Model
- Realm instances are per-thread. Cross-thread options: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#83-thread-model]
- Frozen objects - .freeze() returns immutable snapshot; safe to pass across threads; no auto-update [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#83-thread-model]
- ThreadSafeReference - pass reference, resolve on target thread's Realm instance [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#83-thread-model]
- Config - always thread-safe; open new Realm from config on each background thread [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#83-thread-model]
8.4 Sync Optimization
- Pause sync during bulk local ops: session.suspend() / session.resume() [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#84-sync-optimization]
- Fine-grained subscriptions - never objects('Task') on large collections without a predicate [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#84-sync-optimization]
- downloadBeforeOpen: .never for immediate open from cache [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#84-sync-optimization]
- shouldCompactOnLaunch (Swift) / compactOnLaunch() (Kotlin) to reduce file size [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#84-sync-optimization]
9.2 Offline-First Pattern
- Open immediately from cache, sync in background: [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#92-offline-first-pattern]
10.1 Setup
- Dart 3.0.2+, Flutter 3.10.2+ [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#101-setup]
10.2 Model and Code Generation
- Commit generated *.realm.dart files. [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#102-model-and-code-generation]
10.7 Platform Notes
- iOS: CocoaPods v1.11+ required; pod install after adding realm [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#107-platform-notes]
- Android: AAR included automatically; no manual NDK config needed [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#107-platform-notes]
- macOS/Win/Linux: Pre-compiled x64 binaries; Apple Silicon supported from realm v10+ [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#107-platform-notes]
- Dart isolates: Open a new Realm instance per isolate from the same configuration [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#107-platform-notes]
References
- Atlas Device SDK Docs [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#references]
- Client Resets [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#references]
- Authentication Providers [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#references]
- realm pub.dev [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#references]
- realm-dart GitHub [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#references]
- realm-kotlin GitHub [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#references]
- Atlas Device Sync EOL Forum Post [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#references]
- PowerSync Migration Guide [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#references]
See Also
- [[mongodb-realm-mobile-sync]] - Legacy Realm patterns, Partition-Based Sync, CRDT details, production pitfalls [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#see-also]
- [[mongodb-atlas-app-services]] - App Services platform: auth, rules, triggers - including post-EOL status [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#see-also]
- [[mongodb-atlas-triggers-functions]] - Atlas Triggers and Functions that remain active post-September 2025 [archived source: https://llms-explorer.com/sources/mdb-context-hub/mongodb-atlas-device-sdk/#see-also]
Where this helps
- Supporting an existing production app built on Realm/Atlas Device SDK that must keep running or migrate off Device Sync after its September 30, 2025 end-of-life. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Planning a migration path off Atlas Device Sync to an alternative such as PowerSync, Couchbase Mobile, Ditto, or a custom HTTP sync layer over Atlas. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Continuing to use the local Realm database, which is still viable and sync-free, in an app that no longer needs cloud sync. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Diagnosing a sync conflict or offline-first behavior issue in a still-running Realm/Device Sync app before its shutdown. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Project ideas
- Migrate an existing Flexible Sync app's queryable subscriptions and schema to a PowerSync-based sync layer, using the documented migration guide as the reference path. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Rebuild an app's high-volume telemetry ingestion using asymmetric sync's conceptual model as the reference, moved onto a supported write-only ingestion pipeline post-EOL. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Audit an existing Realm app's schema-migration strategy (incremental block vs deleteRealmIfMigrationNeeded) and harden it before decommissioning Device Sync. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Prototype the local-only Realm database, with no sync, for a new offline-first mobile feature where cloud sync isn't required. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Antipatterns
- Starting a new greenfield mobile sync architecture on Atlas Device Sync — it is permanently shut down and unavailable for new projects. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Materializing large Realm Results<T> into an Array/List unnecessarily instead of keeping them as live, lazily-loaded Results for UI binding. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Opening a new Realm instance across threads without using frozen objects, ThreadSafeReference, or a per-thread Realm instance, risking thread-safety violations. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Updating an indexed position within a synced list instead of appending, which historically increased the odds of an operational-transformation conflict during sync. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Known issues
- Atlas Device Sync reached end-of-life on September 30, 2025 and is permanently shut down; only the local Realm database library and non-sync features (like Atlas Triggers/Functions) remain viable going forward. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Atlas Edge Server, a companion sync tier for intermittent-WAN environments, was deprecated even earlier, before September 30, 2024, and was never a durable option. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- The sync engine used operational transformation, not CRDTs, and did not support field-level custom conflict resolvers — conflict behavior could only be influenced indirectly through schema design, asymmetric sync, or server-side triggers. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
- Primary keys in a synced Realm object are immutable once written, so a schema design that later needs to change a primary key requires a data migration, not a simple field update. [source] — AI-suggested, synthesized from this pack's existing facts — not extracted from a source document.
Children
- Realm Object Model (frontier, viability 3.08 / 5, below research gate)
- Atlas Device Sync
- Flexible Sync Subscriptions
- Atlas Edge Server
- Asymmetric Sync
- Client Reset Strategies
- Realm Authentication
- Flutter Dart Realm SDK
- Offline-First Mobile
- Realm Migration (frontier, viability 3.08 / 5, below research gate)
Frontier under this node: Realm Migration (3.08), Realm Object Model (3.08)