You can design schemas for your 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 Atlas Device Sync configuration setting for your App. When you enable Development Mode, your App can create or update your schema by reading your synced realm files.
Atlas Device 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:
- Enable Development Mode.
- Sync realm files from your local Realm Database.
- 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 Atlas App Services SDKs.
Schemas change as applications evolve. Development mode isn't just for creating schemas. You can also make non-breaking changes to schemas in the same way.
When you sync a realm file, Atlas App Services maps every synced object type to its own collection. App Services then updates the collection schema to match the synced type.
When you later sync an updated object, App Services automatically updates the collection schema.
This lets you update objects in your client code as you develop your app, while Atlas App Services updates the schema to match.
For more information about modifying synced object schemas, including how to make breaking changes, see: Update Your Schema.
When you enable Development Mode, you specify a database to store synced objects. App Services creates new collections in this Development Mode database for every type of synced object.
By default, enabling Development Mode before you have defined permissions creates default permissions that allow any user to access any data. If your application requires permissions during schema development, you can specify data access rules after enabling Development Mode. However, to make changes to the schema, a user must have write access to all data.
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. Development Mode creates a server-side schema associated
with the model. The object syncs to the
App Services 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 App Services will
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.