Navigation

MongoDB Mobile (Beta) Overview

Overview

Modern applications and IoT systems rely on on-device storage to deliver high-quality experiences even in the case of intermittent connectivity.

In order to streamline access patterns and query language from the device to the database, MongoDB has created MongoDB Mobile (Beta) – a full-featured version of MongoDB optimized to run on devices. MongoDB Mobile (Beta) allows developers to use a single database and query language for consistency from devices, through the backend, to the database. MongoDB Mobile (Beta) also provides native connection to MongoDB Stitch, giving simple access to a full application backend from devices.

Note

Note: The MongoDB Mobile beta is not intended for long term production support. Therefore, at this time we do not recommend taking a dependency on MongoDB Mobile when publishing an application to the Apple App Store or Android Play Store.

Background

Until now, when building a mobile or IoT application with MongoDB as the backend, you are faced with two options – either use an on-device database that doesn’t complement your development (slowing progress and decreasing flexibility) or forgo storage at the device level (making it difficult to hold a high bar for data and application experience in the absence of connectivity).

When Stitch was released last year, it brought MongoDB closer to devices by providing a MongoDB-centric backend coupled with native SDKs. Now, in addition to using Stitch’s Android and iOS SDKs to directly query MongoDB Atlas from devices, applications can use the same SDKs to interact with an on-device MongoDB database – MongoDB Mobile (Beta).

MongoDB Mobile (Beta) with Stitch provides a few core benefits:

  • Persist data directly on-device
  • Use consistent, standard access patterns across device, backend, and database

In the near future, MongoDB Mobile (Beta) will also support syncing data between local and remote MongoDB instances.

Note

The MongoDB Mobile (Beta) database is aligned with MongoDB 4.0.

Getting Started

MongoDB Mobile supports development on the following devices:

OS OS Version Target Architecture
iOS 10.2+ armv8-a
iOS Simulator 10.2+ x86_64
tvOS 10.2+ armv8-a
tvOS Simulator 10.2+ x86_64
watchOS 4.3+ armv7-k
watchOS Simulator 4.3+ i386
macOS 10.10+ x86_64
Unified Darwin n/a multiple
Android 7.0+ (Nougat) armeabi-v7a
Android 7.0+ (Nougat) arm64-v8a
Android 7.0+ (Nougat) x86_64
Unified Android 7.0+ (Nougat) multiple
Ubuntu 16.04+ x86_64

MongoDB Mobile (Beta) comprises two core pieces:

  • MongoDB Mobile (Beta): A mobile optimized version of the database designed to run on lower powered devices such as mobile phones or IoT devices.
  • Stitch SDKs: Native Java (Android and IoT) and Swift (iOS) SDKs that manage the lower-level database operations and provide methods to interact with MongoDB Mobile (Beta) as well as MongoDB Stitch.

The Stitch SDKs provide the following means of interacting with MongoDB Mobile (Beta):

  • Local: SDKs can initialize and access MongoDB Mobile (Beta). This supports most CRUD, aggregation, and operational commands supported by MongoDB Drivers targeting MongoDB Mobile (Beta).
  • Remote: SDKs also provide access to standard Stitch features, including access to MongoDB Atlas, server-side logic, and other external services.
  • Mobile Sync (Upcoming): Additional infrastructure in Stitch and the SDKs for syncing changes between MongoDB Mobile (Beta) and MongoDB Atlas deployments as well as intelligently resolving conflicts.

Comparing MongoDB and MongoDB Mobile (Beta)

To improve the size and performance of MongoDB Mobile (Beta), some components found in MongoDB 4.0 are not included in the mobile version. The following list details the components that are not included:

  • Sharding and Replication

    MongoDB Mobile (Beta) operates as a standalone instance with a single node present on the mobile device.

  • Storage Engine Configuration

    MongoDB Mobile (Beta) uses SQLite as a simple key-value store behind the scenes due to its stability and prevalence on devices. MongoDB Mobile (Beta) does not provide the ability to configure the underlying SQLite deployment or use other storage engines.

  • Database Authentication

    MongoDB Mobile (Beta) only accepts connections that originate from within the application. These connections are trusted, so database authentication is disabled in MongoDB Mobile (Beta). When moving data between MongoDB Mobile (Beta) and an external component, we recommend using a combination of authentication and security rules on the server-side.

  • Encryption/SSL

    MongoDB Mobile (Beta) does not use SSL for connections originating from the application. When using the Stitch SDK to transfer data outside of the device, however, connections are encrypted with SSL.

    Additionally, MongoDB Mobile (Beta) does not provide encryption at rest. MongoDB recommends that users encrypt necessary fields within the application before storing the data in MongoDB Mobile (Beta).

  • Change streams

    MongoDB Mobile (Beta) database does not support the creation of change streams.

  • Server-side JavaScript Execution

    MongoDB Mobile (Beta) does not support Server-side JavaScript execution.

Upcoming Mobile Optimizations

The following aspects of the MongoDB Mobile beta are still being optimized and are expected to improve over the course of the beta period:

  • MongoDB Mobile (Beta) footprint
    The product binaries currently include many unused components, which leads to an unnecessarily large footprint for MongoDB Mobile (Beta). We are working on significantly reducing the size of the mobile package.
  • MongoDB Mobile (Beta) packaging for Java
    Currently, certain files required for MongoDB Mobile (Beta) must be downloaded, rather than installed with Gradle. We are working to package all necessary files so they are included in the Gradle build.