appservices function run
On this page
Atlas Device Sync, Atlas Edge Server, Data API, HTTPS Endpoints, GraphQL, and Static Hosting are deprecated. Commands related to these features are also deprecated.
Atlas Device Sync, Atlas Edge Server, Data API, and HTTPS Endpoints are deprecated. Refer to the deprecation page for details.
Run a Function from your app
Functions allow you to define and execute server-side logic for your app. Once you select and run a Function for your app, the following will be displayed:
A list of logs, if present
The function result as a document
A list of error logs, if present
Syntax
Command Syntax
appservices function run [options]
Options
Name | Type | Required | Description |
---|---|---|---|
-a, --app | string | false | Specify the name or ID of an App Service to run its function |
--project | string | false | Specify the ID of a MongoDB Atlas project |
--name | string | false | Specify the name of the function to run |
--args | stringArray | false | Specify the args to pass to your function [Learn more] |
--user | string | false | Specify which user to run the function as (Note: Using <none> will run as the System user) (Default value: <none>; Allowed values: <none>, <userID>) |
--local | string | false | Specify the local filepath of an app to run functions from |
--use-local-app | false | Run function from local app | |
--include-node-modules | false | Include node_modules as a dependency | |
--include-package-json | false | Include package.json as a dependency | |
-h, --help | false | help for run |
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 |