MongoDB Atlas Device SDK
Parent: MongoDB Atlas · researched 2026-05-29T14:11:22.199Z· 18 sources · 10 concepts · skill mongodb-atlas-device-sdk
> DEPRECATION NOTICE — Critical Context for All Readers
MongoDB Atlas Device SDK & Edge Server
- > DEPRECATION NOTICE - Critical Context for All Readers [source]
- > 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. [source]
- > 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. [source]
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: [source]
- Supporting existing Realm/Device Sync production apps [source]
- Advising on the EOL migration path for a current Realm customer [source]
- Understanding the Realm local database (still viable open-source, sync-free) [source]
- For new mobile sync architectures, redirect to alternatives: PowerSync, Couchbase Mobile, Ditto, or custom HTTP sync over Atlas. [source]
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: [source]
- 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. [source]
- 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. [source]
- 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. [source]
1. SDK Language Matrix
- MongoDB maintained official SDKs for seven language/platform targets: [source]
- Package identifiers: [source]
- Swift: RealmSwift (SPM: realm-swift), CocoaPods pod RealmSwift [source]
- Kotlin: io.realm.kotlin - library-base (local) + library-sync (Device Sync) [source]
- Java: io.realm:realm-android - Gradle plugin realm-android [source]
- JavaScript: npm realm (was realm@^12) [source]
- .NET: NuGet Realm + Realm.Fody [source]
- Flutter/Dart: pub.dev realm (v20.x current), realm_generator [source]
- C++: header-only via CPM/cmake [source]
- 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. [source]
2.1 Defining Objects
2.3 Primary Keys
2.5 Schema Migration
- Strategies: incremental block (production), deleteRealmIfMigrationNeeded (dev only), additive fields (no block needed). [source]
3. Atlas Device Sync — Flexible Sync
- > Status: EOL September 30, 2025. [source]
3.3 Subscriptions
- Queryable fields must be declared in App Services UI - only top-level primitives, lists, sets eligible. [source]
3.5 Offline-First Behavior
- Reads/writes succeed immediately against local Realm file [source]
- Writes append to internal upload queue [source]
- On reconnect: upload queue replayed to server, server changes replayed locally [source]
- Conflicts resolved by sync engine before applying [source]
- Automatic reconnection with exponential backoff [source]
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. [source]
4. Atlas Edge Server
- > Status: Deprecated before September 30, 2024. [source]
- Middle tier between Device SDK clients and Atlas for intermittent-WAN environments. [source]
- vs Direct Atlas Sync: [source]
- Deployment (Docker): [source]
- SDK connection to Edge Server: [source]
- Admin API (port 27020): GET /api/edge/v1.0/info, GET /api/edge/v1.0/connection, POST /api/edge/v1.0/pause|resume [source]
6. Authentication Providers
- Token management: [source]
- Access tokens expire after 30 minutes; SDK auto-refreshes using refresh token [source]
- Refresh tokens expire after 60 days (configurable); user must re-authenticate on expiry [source]
- Stored in browser localStorage/sessionStorage (Web SDK) or device secure keystore (mobile) [source]
- Identity linking: [source]
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. [source]
- Custom resolvers are not supported at field level. Influence conflict behavior via: [source]
- Asymmetric sync - no conflict possible (write-only) [source]
- Embedded objects - parent subtree treated atomically [source]
- Server-side Atlas Triggers - reactive post-sync reconciliation [source]
- Schema design - append to lists rather than update indexes [source]
7.3 Conflict Design Patterns
- Append to lists rather than update indexed positions [source]
- Use @MapTo (Java/legacy Kotlin) or @PersistedName (modern Kotlin SDK) for canonical Atlas field names [source]
- Prefer embedded objects for sub-documents (atomic parent update) [source]
- High-frequency telemetry → asymmetric sync (no conflict surface) [source]
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. [source]
8.2 Transactions
- One realm.write {} = one ACID commit. Batch all related writes in a single transaction: [source]
8.3 Thread Model
- Realm instances are per-thread. Cross-thread options: [source]
- Frozen objects - .freeze() returns immutable snapshot; safe to pass across threads; no auto-update [source]
- ThreadSafeReference - pass reference, resolve on target thread's Realm instance [source]
- Config - always thread-safe; open new Realm from config on each background thread [source]
8.4 Sync Optimization
- Pause sync during bulk local ops: session.suspend() / session.resume() [source]
- Fine-grained subscriptions - never objects('Task') on large collections without a predicate [source]
- downloadBeforeOpen: .never for immediate open from cache [source]
- shouldCompactOnLaunch (Swift) / compactOnLaunch() (Kotlin) to reduce file size [source]
9.2 Offline-First Pattern
- Open immediately from cache, sync in background: [source]
10.1 Setup
- Dart 3.0.2+, Flutter 3.10.2+ [source]
10.2 Model and Code Generation
- Commit generated *.realm.dart files. [source]
10.7 Platform Notes
- iOS: CocoaPods v1.11+ required; pod install after adding realm [source]
- Android: AAR included automatically; no manual NDK config needed [source]
- macOS/Win/Linux: Pre-compiled x64 binaries; Apple Silicon supported from realm v10+ [source]
- Dart isolates: Open a new Realm instance per isolate from the same configuration [source]
References
See Also
- [[mongodb-realm-mobile-sync]] - Legacy Realm patterns, Partition-Based Sync, CRDT details, production pitfalls [source]
- [[mongodb-atlas-app-services]] - App Services platform: auth, rules, triggers - including post-EOL status [source]
- [[mongodb-atlas-triggers-functions]] - Atlas Triggers and Functions that remain active post-September 2025 [source]
Children
- Realm Object Model (frontier)
- Atlas Device Sync (frontier)
- Flexible Sync Subscriptions (frontier)
- Atlas Edge Server (frontier)
- Asymmetric Sync (frontier)
- Client Reset Strategies (frontier)
- Realm Authentication (frontier)
- Flutter Dart Realm SDK (frontier)
- Offline-First Mobile (frontier)
- Realm Migration (frontier)
Frontier under this node: Asymmetric Sync, Atlas Device Sync, Atlas Edge Server, Client Reset Strategies, Flexible Sync Subscriptions, Flutter Dart Realm SDK, Offline-First Mobile, Realm Authentication, Realm Migration, Realm Object Model