bsondump
macOS Sierra and Go 1.6 Incompatibility
Users running on macOS Sierra require the 3.2.10 or newer versionof bsondump
.
Synopsis
The bsondump
converts BSON files into human-readableformats, including JSON. For example, bsondump
is usefulfor reading the output files generated by mongodump
.
Run bsondump
from the system command line, not the mongo
shell.
Important
bsondump
is a diagnostic tool for inspectingBSON files, not a tool for data ingestion or other application use.
Starting in version 4.2, bsondump
uses ExtendedJSON v2.0 (Canonical mode)to format its data.
Availability
The bsondump
tool is part of the MongoDB tools package. Consult theinstallation guide for your platform forinstructions on how to install the tools package as part of yourMongoDB installation.
The tools package is also available from theMongoDB Download Center,either as a separate tools
download, or contained within theTGZ
or ZIP
downloads, depending on platform. On Windows, the MSI
installer includes all tools as part of the default installation.
Tip
If downloading the TGZ
or ZIP
files from the DownloadCenter, you may want to update your PATH
environmentvariable to include the directory where you installed these tools.See the installation guidefor your platform for more information.
Options
Changed in version 3.0.0: bsondump
removed the —filter
, —dbpath
and the—noobjcheck
options.
—verbose
,
-v
- Increases the amount of internal reporting returned on standard outputor in log files. Increase the verbosity with the
-v
form byincluding the option multiple times, (e.g.-vvvvv
.)
This option suppresses:
- output from database commands
- replication activity
- connection accepted events
- connection closed events
—objcheck
- Validates each BSON object before outputting it in JSONformat. By default, bsondump enables
—objcheck
.For objects with a high degree of sub-document nesting,—objcheck
can have a small impact on performance.
—type
=<json|debug>
- Changes the operation of bsondump from outputting“JSON” (the default) to a debugging format.
New in version 3.0.0.
Outputs documents in a pretty-printed format JSON.
New in version 3.4.
Specifies a path to a BSON file to dump to JSON. —bsonFile
isan alternative to the positional <bsonFilename>
option.
By default, bsondump reads from standard input.
<bsonFilename>
- The final argument to bsondump is a document containingBSON. This data is typically generated bybsondump or by MongoDB in a rollback operation.
New in version 3.4.
Specifies the path of the file to which bsondump should writeits output JSON data.
By default, bsondump writes to standard output.
Examples
Changed in version 3.4.
By default, bsondump
outputs data to standard output. Tocreate corresponding JSON files, you can use the—outFile
option:
- bsondump --outFile=collection.json collection.bson
Use the following command (at the system shell) to produce debuggingoutput for a BSON file:
- bsondump --type=debug collection.bson