convex data command allows you to inspect your Convex deployment’s database directly from the command line.
Usage
Arguments
If specified, list documents in this table. If omitted, lists all tables in the database.
Options
List only the
n most recently created documents.Must be a positive integer.Order the documents by their
_creationTime.Choices: asc, descasc- Oldest documents firstdesc- Newest documents first
Path to the component in the component tree defined in
convex.config.ts.Components are a beta feature.Format to print the data in.Choices:
jsonArray, json, jsonLines, jsonl, prettyjsonArray(orjson) - Print the data as a JSON array of objectsjsonLines(orjsonl) - Print the data as a JSON object per linepretty- Print the data in a human-readable format (default for terminal output)
Examples
List all tables
List all tables in your deployment:List documents in a table
View the most recent documents in theusers table:
Limit results
Show only the 10 most recent documents:Show oldest documents
List documents in ascending order by creation time:Export as JSON
Output data in JSON format for processing:Export as JSON Lines
Output data as JSON Lines for streaming or line-by-line processing:Query production data
List tables in your production deployment:Query component data
List documents from a table in a component:Output formats
Pretty format (default)
Human-readable table format:JSON Array format
JSON Lines format
Deployment selection
Theconvex data command supports deployment selection:
--prod- Target production deployment--preview-name <name>- Target a preview deployment--url <url>- Target a specific deployment URL--admin-key <key>- Admin key for authentication
System fields
All documents include these system fields:_id- Unique document identifier_creationTime- Timestamp when the document was created (milliseconds since epoch)
Use cases
Debugging
Quickly inspect data during development:Data export
Export data for analysis or backup:Schema verification
Check what tables exist in your deployment:Production monitoring
Quickly check recent data in production:Limitations
- Maximum limit is bounded by deployment limits
- Large datasets should use the export command instead
- Does not support filtering beyond creation time ordering
- For complex queries, use
convex runto execute custom query functions