Usage
Arguments
Identifier of the function to run, like
listMessages or dir/file:myFunction.JSON-formatted arguments object to pass to the function. Defaults to
{}.Options
Watch a query, printing its result if the underlying data changes. The function must be a query.
Push code to deployment before running the function. Not supported for production deployments.
JSON-formatted UserIdentity object to run the function as a specific user.
Path to the component in the component tree defined in
convex.config.ts.Run the function on this project’s production deployment instead of dev.
Whether to check TypeScript files with
tsc --noEmit. Options: enable, try, disable. Defaults to try.Only used when --push is specified.Check TypeScript files within component implementations with
tsc --noEmit. Defaults to false.Only used when --push is specified.Regenerate code in
convex/_generated/. Options: enable, disable. Defaults to enable.Only used when --push is specified.Path to a custom file of environment variables for choosing the deployment. Same format as
.env.local or .env files, and overrides them.Examples
Run a query
Execute a query function and see the result:Run a mutation with arguments
Execute a mutation with JSON arguments:Watch a query for changes
Continuously watch a query and see updates when data changes:Run with push
Push your latest code changes and then run the function:Run on production
Execute a query on your production deployment:Run as a specific user
Execute a function with a user identity:Complex arguments
Pass complex nested objects:Common use cases
Testing during development
Quickly test a function you’re working on:One-off data operations
Run a mutation to fix or update data:Real-time monitoring
Watch query results update live during development:Production queries
Inspect production data safely with read-only queries:Notes
- The
--pushflag is not supported for production deployments. Usenpx convex deployto push to production. - When using
--watch, press Ctrl+C to stop watching and exit. - Arguments must be valid JSON. Use single quotes around the JSON string in bash/zsh shells.
- Query functions are read-only and safe to run on production.
- Be careful when running mutations on production deployments.