Docs Menu

Development Mode

On this page

  • Overview
  • Design Schemas in Code
  • Create Schemas
  • Update Schemas
  • Bypass Rules and Validation
  • Key Concepts
  • Development Database
  • Summary

Development mode is a Realm Sync configuration setting for your Realm app. Enable development mode to streamline schema design, but disable it in production applications.

Realm Sync development mode enables developers to develop faster, and design schemas directly in client application code.

Tip
See also:

For a guided walkthrough of how to enable or disable development mode, see: Enable/Disable Development Mode.

With development mode enabled, you can design schemas directly in client code. The objects and relationships that you define in your application become the server-side document schema based on your SDK models. Realm SDKs give you language-specific tools to define and work with these objects.

In practice, here's how the server-side document schema definition process works with development mode:

  1. Enable development mode.
  2. Sync realm files from your local Realm Database.
  3. The objects in the files become the definitions for your schema.

After you have synced realm files to define your schema, you can view the schema, and you can also export your data model for any or all of the MongoDB Realm SDKs.

Schemas change as applications evolve. Development mode isn't just for creating schemas. You can also make additive changes to schemas in the same way.

When you sync a realm file, MongoDB Realm maps every synced object type to its own collection. Realm then updates the collection schema to match the synced type.

When you later sync an updated object, Realm automatically updates the collection schema.

This lets you update objects in your client code as you develop your app, while MongoDB Realm updates the schema to match.

Tip
See also: Modifying synced object schemas

For more information about modifying synced object schemas, including how to make destructive changes, see: Synced Schema Changes.

When you enable development mode, Realm bypasses data access rules and schema validation. This lets developers iterate quickly to develop new features or fix bugs. However, this aspect of development mode means it's vital to disable it in production. Leaving development mode enabled in production can expose your app to security vulnerabilities.

Warning

Ensure your development database does not contain production data. When you enable development mode, Realm does not enforce data access rules. If your development database contains production data, developer mode would leave that data vulnerable to inadvertent or malicious access.

Note
Specify Data Access Rules with Development Mode Enabled

By default, enabling development mode disables all data access rules, allowing any user to access any data. However, if your application requires permissions during schema development, you can specify data access rules after enabling development mode.

When you enable Development Mode, you specify a database to store synced objects. Realm creates new collections in this Development Mode database for every type of synced object.

Realm does not enforce data access rules while in Development Mode. Your Development Mode Database should not contain any production or user data.

Example

Specify a Development Mode database of myapp. Your iOS client has a Person model. You sync a realm that contains an instance of the Person object. Developer Mode creates a server-side schema associated with the model. The object syncs to the myapp.Person collection.

Realm continues creating new server-side schemas and collections for each new object type. If you later add a Dog object, that object will sync to a new myapp.Dog collection that Realm will create.

  • Enable Development Mode to create and update schemas from client code.
  • Sync to a Development Mode Database, where Realm will automatically create collections to match your object types.
  • Keep in mind that Realm does not enforce data access rules and schema validation while Development Mode is enabled.
  • Do not use Development Mode in production.
Give Feedback
© 2021 MongoDB, Inc.

About

  • Careers
  • Legal Notices
  • Privacy Notices
  • Security Information
  • Trust Center
© 2021 MongoDB, Inc.