Export a Realm App with Realm CLI
You can use the MongoDB Realm CLI to export your Realm app's configuration.
When you export your Realm app, the export does not include the secrets. To add your secrets to a different app, refer to the documentation on migrating configuration, including secrets, to a new Realm app.
Export
is the v1 Realm CLI command, and is an
alias for pull
in the v2 Realm CLI.
Prerequisites
- A properly installed copy of
realm-cli
that has been added to your systemPATH
. - A MongoDB Atlas programmatic API key. You must be a Project Owner to export a Realm app.
Procedure
Run the App Export Command
You can export an application's configuration directory by specifying its remote App ID and an optional local path. If you do not specify a local path, the command outputs the configuration directory in the current working directory.
realm-cli pull --remote=<App ID> --local=<Output Directory Path> [options]
The directory specified by --local
must not already exist, otherwise
realm-cli
throws an error and does not pull the configuration files.
The command also supports additional flags that you can optionally include to customize your app. The following table lists common flags you might use:
--include-dependencies | If specified, exports any external dependencies included
in a node_modules archive in the /functions directory of your
Realm app. |
--include-hosting | If specified, exports all hosted static assets in the hosting/files
directory of your Realm app. |
Output
Your application will be exported to a local application directory. If
you did not specify a path for the directory with --local
, it will
be exported with the same name as the application into the current
working directory.