Docs Menu

Enable or Disable Development Modeicons/link.png

On this page

  • Why Use Development Mode?
  • Key Concepts
  • Enable Development Mode
  • Disable Development Mode

You can design schemas for your Realm app 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.

You can infer schemas from your client object models by enabling development mode. Development mode is a Realm Sync configuration setting for your Realm app. When you enable development mode, your Realm app can create or update your schema by reading your synced realm files.

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

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: Update Your Schema.

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.

Important
Disable Development Mode for Production Apps

Development mode is a development utility that is not suitable for production use. Make sure that you turn off development mode before you make your app accessible in a production environment.

Give Feedback
MongoDB logo
© 2021 MongoDB, Inc.

About

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