mongoexport
Verified for current stable LTS
Mongoexport Command: Export Collection To Json File With Query
Use for export collection to json file with query with Mongoexport. Exact CLI syntax to export collection to json file with query using Mongoexport.
When to use this: Use for export collection to json file with query with Mongoexport.
Command Syntax
mongoexport --db=<database_name> --collection=<collection_name> --query="<query_object>" --out=<path/to/file.json> mongoexport --db=<database_name> --collection=<collection_name> --query="<query_object>" --out=<path/to/file.json> Command Breakdown
--db=<database_name>- Command Option
- Tool-specific option used by this command invocation.
--collection=<collection_name>- Command Option
- Tool-specific option used by this command invocation.
--query="<query_object>"- Command Option
- Tool-specific option used by this command invocation.
--out=<path/to/file.json>- Command Option
- Tool-specific option used by this command invocation.
FAQ
Purpose: Exact syntax to export collection to json file with query using Mongoexport.
Test path: Replace placeholders and run destructive commands in a disposable workspace first.
Flag behavior: Tool version, platform, and shell can change behavior.
Improve This Command
Suggest a correction, safer default, or version-specific note for this entry.
Related Operations
Mongoexport Command: Display Help For Mongoexport
mongoexport --help Mongoexport Command: Export Collection As Json Array mongoexport --collection=<collection_name> --jsonArray Mongoexport Command: Export Collection To Csv mongoexport --collection=<collection_name> --type=<csv> --fields="<field1,field2,...>" --out=<path/to/file.csv> Mongoexport Command: Export Collection To Csv With Query And No Header mongoexport --collection=<collection_name> --type=<csv> --fields="<field1,field2,...>" --queryFile=<path/to/file> --noHeaderLine --out=<path/to/file.csv> Mongoexport Command: Export Collection To Stdout Json mongoexport --uri=<connection_string> --collection=<collection_name>