appservices schema generate
On this page
Generate a schema based on a sample set of documents in a collection or from a single JSON file
When run with a selected database and collection, generates a schema based on a sample of documents; when run with the “--path” flag, generates a schema based on the JSON file at the provided path.
Syntax
appservices schema generate [options]
Options
Name | Type | Required | Description |
---|---|---|---|
-a, --app | string | false | Specify the name or ID of an App Service on which to generate a schema |
--project | string | false | Specify the ID of a MongoDB Atlas project |
--local | string | false | Specify the local filepath of an app to generate a schema |
-s, --datasource | string | false | Specify the name or ID of the datasource to sample from |
-d, --database | string | false | Specify the name of the database to sample from |
-c, --collection | string | false | Specify the name or ID of the collection to sample from |
--path | string | false | Specify the path to the JSON file to generate a schema from |
--title | string | false | Specify a title to name the generated schema (Note: Title can only be used with the path flag) |
-l, --limit | int | false | Specify the maximum number of documents to sample from This value defaults to 500. |
--skip | int | false | Specify the numbers of documents to skip |
--filter | string | false | Specify a filter document to sample from a subset of the data (Allowed format: '{"field": "value"}') |
--projection | string | false | Specify which fields to return in the schema (Allowed format: '{"field": 1}') |
--sort | string | false | Specify the sort order of the returned documents (Allowed format: '{"field": -1}') |
--save | false | Automatically save the schema to the filesystem (Note: The --save flag will automatically save the schema to the corresponding data_sources/datasource/database/collection folder, and prompt for the datasource, database, and collection if not given) | |
-h, --help | false | help for generate |
Inherited Options
Name | Type | Required | Description |
---|---|---|---|
--profile | string | false | Specify your profile (Default value: "default") [Learn more] |
--telemetry | string | false | Enable/Disable CLI usage tracking for your current profile (Default value: "on"; Allowed values: "on", "off") |
-o, --output-target | string | false | Write CLI output to the specified filepath |
-f, --output-format | string | false | Set the CLI output format (Default value: <blank>; Allowed values: <blank>, "json") |
--disable-colors | false | Disable all CLI output styling (e.g. colors, font styles, etc.) | |
-y, --yes | false | Automatically proceed through CLI commands by agreeing to any required user prompts |