Navigation

bsondump

On this page

  • Synopsis
  • Compatibility
  • Installation
  • Options
  • Examples

The bsondump converts BSON files into human-readable formats, including JSON. For example, bsondump is useful for reading the output files generated by mongodump.

Important

bsondump is a diagnostic tool for inspecting BSON files, not a tool for data ingestion or other application use.

bsondump uses Extended JSON v2.0 (Canonical mode) to format its data.

Run bsondump from the system command line, not the mongo shell.

Starting with MongoDB 4.4, bsondump is now released separately from the MongoDB Server and uses its own versioning, with an initial version of 100.0.0. Previously, bsondump was released alongside the MongoDB Server and used matching versioning.

For documentation on the MongoDB 4.2 or earlier versions of bsondump, reference the MongoDB Server Documentation for that version of the tool:

Note
Quick links to older documentation

This documentation is for version 100.5.0 of bsondump.

bsondump version 100.5.0 supports the following versions of the MongoDB Server:

  • MongoDB 5.0
  • MongoDB 4.4
  • MongoDB 4.2
  • MongoDB 4.0

While bsondump may work on earlier versions of MongoDB server, any such compatibility is not guaranteed.

bsondump version 100.5.0 is supported on the following platforms:

Note
Platform Support EOL Notice
s390x ('zseries')
Support removed in MongoDB Database Tools 104.0.0. Previous versions of the Database Tools that support the s390x architecture can be downloaded from Archived Releases.
x86_64
ARM64
PPC64LE
s390x
Amazon 2
Amazon 2013.03+
Debian 10
Debian 9
Debian 8
RHEL / CentOS 8
RHEL / CentOS 7
RHEL / CentOS 6
SUSE 15
SUSE 12
Ubuntu 20.04
Ubuntu 18.04
Ubuntu 16.04
Ubuntu 14.04
Windows 8 and later
Windows Server 2012 and later
macOS 10.12 or later

The bsondump tool is part of the MongoDB Database Tools package:

Follow the Database Tools Installation Guide to install bsondump.

--help

Returns information on the options and use of bsondump.

--verbose, -v

Increases the amount of internal reporting returned on standard output or in log files. Increase the verbosity with the -v form by including the option multiple times, (e.g. -vvvvv.)

--quiet

Runs bsondump in a quiet mode that attempts to limit the amount of output.

This option suppresses:

  • output from database commands
  • replication activity
  • connection accepted events
  • connection closed events
--version

Returns the bsondump release number.

--objcheck

Validates each BSON object before outputting it in JSON format. 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.

--pretty

Outputs documents in a pretty-printed format JSON.

--bsonFile

Specifies the path to a BSON file to dump to JSON. --bsonFile is an alternative to the positional <bsonFilename> option.

By default, bsondump reads from standard input.

<bsonFilename>

The final argument to bsondump is a document containing BSON. This data is typically generated by bsondump or by MongoDB in a rollback operation.

--outFile=<file>

Specifies the path of the file to which bsondump should write its output JSON data.

By default, bsondump writes to standard output.

Run bsondump from the system command line, not the mongo shell.

By default, bsondump outputs data to standard output. To create 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 debugging output for a BSON file:

bsondump --type=debug collection.bson
Give Feedback

On this page

  • Synopsis
  • Compatibility
  • Installation
  • Options
  • Examples