MongoDB Mobile Data Sheet
MongoDB Mobile is a compact, embeddable implementation of MongoDB designed for iOS, Android and IoT applications. It allows developers to leverage their MongoDB knowledge when creating mobile apps, smart devices, IoT sensors and gateways which are essential to a modern business's ability to reach customers.
MongoDB Mobile is delivered alongside the MongoDB Stitch series of cloud-enabled data services. MongoDB Mobile is able to work standalone or be synchronized with a MongoDB Atlas cloud-hosted database through MongoDB Stitch Atlas Device Sync, making it ideal for unifying your approach to database technology at all scales. The MongoDB Mobile SDK also allows for managed connections to Atlas clusters through the MongoDB Stitch QueryAnywhere service.
MongoDB Mobile Features
Carefully tailored to the needs of an embedded developer, MongoDB Mobile delivers the features that are relevant to a mobile application:
- A Unified SDK
: There's a single client SDK package for each platform with a common API that enables access to the local database or any remote MongoDB databases. With just one package to install on each platform, it is simple to incorporate into projects.
: Connect to a local, embedded database instance, through MongoDB Stitch Query Anywhere or synchronize with a MongoDB Atlas hosted MongoDB cluster (see MongoDB Atlas Device Sync Features).
- Extensive MQL support
: The MongoDB Query Language, as of MongoDB 3.4 is supported by the SDK and includes secondary indexes and aggregation pipeline.
- Native Language Support
: The SDK is available for Swift on iOS or Java on Android.
- 32/64 Bit Support
: For all iOS and Android devices.
- Easy to Embed
: Using CocoaPods on iOS or Maven on Android.
- Compact and Focussed
: Designed for mobile, single application access, things like authentication, replication, and sharding could be trimmed. With a resulting 15-20 MB storage footprint, MongoDB Mobile offers developers a familiar environment with low overhead.
MongoDB Atlas Device Sync Features
: Atlas Device Sync is controlled from within the MongoDB Mobile application.
- Offline and Responsive
: Mobile provides local low latency reads and writes, even when the device is offline; database queries and updates go directly to the local embedded MongoDB Mobile database. Users can continue working even when they are out of cellular data range or during an internet outage.
- Online and Synchronized
: Whenever connectivity is restored, Atlas Device Sync automatically synchronizes updated documents between the local and remote databases.
- Bi-directional and Reactive
: Updates flow between the local and remote databases with any conflicts automatically detected and passed to a function which can decide which version of an update wins. Supporting basic resolution methods such as one side always wins, first or last write always wins, while also allowing for more complex custom conflict resolution such as merging the two documents.
- Managed Synchronization
: Updates pass through the Stitch platform with its user and role management, access control and logging. This configuration is common and shared with other Stitch features, reducing administrative complexity.
Example Android Code
// Create the default Stitch Client final StitchAppClient client = Stitch.initializeDefaultAppClient("
// Create a Client for MongoDB Mobile (initializing MongoDB Mobile) final MongoClient mobileClient = client.getServiceClient(LocalMongoDbService.clientFactory);
// Point to the target collection and insert a document MongoCollection
localCollection = mobileClient.getDatabase("mydb").getCollection("mycollection"); localCollection.insertOne(document);
//Find all documents that match the find criteria Document query = new Document(); query.put("name", new BsonString("veirs")); FindIterable
cursor = localCollection.find(query); ArrayList results = (ArrayList ) cursor.into(new ArrayList ());