mongo-tool

command module
v1.0.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

README

MongoDB Tools

  • bsondump - display BSON files in a human-readable format
  • mongoimport - Convert data from JSON, TSV or CSV and insert them into a collection
  • mongoexport - Write an existing collection to CSV or JSON format
  • mongodump/mongorestore - Dump MongoDB backups to disk in .BSON format, or restore them to a live database
  • mongostat - Monitor live MongoDB servers, replica sets, or sharded clusters
  • mongofiles - Read, write, delete, or update files in GridFS
  • mongotop - Monitor read/write activity on a mongo server

Report any bugs, improvements, or new feature requests at https://jira.mongodb.org/browse/TOOLS

Building Tools

We currently build the tools with Go version 1.15. Other Go versions may work but they are untested.

Using go get to directly build the tools will not work. To build them, it's recommended to first clone this repository:

go get -u gitee.com/tym_hmm/mongo-tool

Then run ./make build to build all the tools, placing them in the bin directory inside the repository.

You can also build a subset of the tools using the -tools option. For example, ./make build -tools=mongodump,mongorestore builds only mongodump and mongorestore.

To use the build/test scripts in this repository, you must set GOROOT to your Go root directory. This may depend on how you installed Go.

export GOROOT=/usr/local/go

Updating Dependencies

Starting with version 100.3.1, the tools use go mod to manage dependencies. All dependencies are listed in the go.mod file and are directly vendored in the vendor directory.

In order to make changes to dependencies, you first need to change the go.mod file. You can manually edit that file to add/update/remove entries, or you can run the following in the repository directory:

go mod edit -require=<package>@<version>  # for adding or updating a dependency
go mod edit -droprequire=<package>        # for removing a dependency

Then run go mod vendor -v to reconstruct the vendor directory to match the changed go.mod file.

Optionally, run go mod tidy -v to ensure that the go.mod file matches the mongo-tools source code.

Contributing

See our Contributor's Guide.

Documentation

See the MongoDB packages documentation.

For documentation on older versions of the MongoDB, reference that version of the MongoDB Server Manual:

Adding New Platforms Support

See our Adding New Platform Support Guide.

Vendoring the Change into Server Repo

See our Vendor the Change into Server Repo.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package bsondump converts BSON files into human-readable formats such as JSON.
Package bsondump converts BSON files into human-readable formats such as JSON.
main
Main package for the bsondump tool.
Main package for the bsondump tool.
common
auth
Package auth provides utilities for performing tasks related to authentication.
Package auth provides utilities for performing tasks related to authentication.
bsonutil
Package bsonutil provides utilities for processing BSON data.
Package bsonutil provides utilities for processing BSON data.
db
Package db implements generic connection to MongoDB, and contains subpackages for specific methods of connection.
Package db implements generic connection to MongoDB, and contains subpackages for specific methods of connection.
idx
intents
Package intents provides utilities for performing dump/restore operations.
Package intents provides utilities for performing dump/restore operations.
json
Package json implements encoding and decoding of JSON objects as defined in RFC 4627.
Package json implements encoding and decoding of JSON objects as defined in RFC 4627.
log
Package log provides a utility to log timestamped messages to an io.Writer.
Package log provides a utility to log timestamped messages to an io.Writer.
options
Package options implements command-line options that are used by all of the mongo tools.
Package options implements command-line options that are used by all of the mongo tools.
password
Package password handles cleanly reading in a user's password from the command line.
Package password handles cleanly reading in a user's password from the command line.
progress
Package progress exposes utilities to asynchronously monitor and display processing progress.
Package progress exposes utilities to asynchronously monitor and display processing progress.
testutil
Package testutil implements functions for filtering and configuring tests.
Package testutil implements functions for filtering and configuring tests.
text
Package text provides utilities for formatting text data.
Package text provides utilities for formatting text data.
txn
Package txn implements functions for examining and processing transaction oplog entries.
Package txn implements functions for examining and processing transaction oplog entries.
util
Package util provides commonly used utility functions.
Package util provides commonly used utility functions.
Package mongodump creates BSON data from the contents of a MongoDB instance.
Package mongodump creates BSON data from the contents of a MongoDB instance.
main
Main package for the mongodump tool.
Main package for the mongodump tool.
Package mongoexport produces a JSON or CSV export of data stored in a MongoDB instance.
Package mongoexport produces a JSON or CSV export of data stored in a MongoDB instance.
main
Main package for the mongoexport tool.
Main package for the mongoexport tool.
Package mongofiles provides an interface to GridFS collections in a MongoDB instance.
Package mongofiles provides an interface to GridFS collections in a MongoDB instance.
main
Main package for the mongofiles tool.
Main package for the mongofiles tool.
Package mongoimport allows importing content from a JSON, CSV, or TSV into a MongoDB instance.
Package mongoimport allows importing content from a JSON, CSV, or TSV into a MongoDB instance.
csv
Package csv reads and writes comma-separated values (CSV) files.
Package csv reads and writes comma-separated values (CSV) files.
main
Main package for the mongoimport tool.
Main package for the mongoimport tool.
Package mongorestore writes BSON data to a MongoDB instance.
Package mongorestore writes BSON data to a MongoDB instance.
main
Main package for the mongorestore tool.
Main package for the mongorestore tool.
ns
Package mongostat provides an overview of the status of a currently running mongod or mongos instance.
Package mongostat provides an overview of the status of a currently running mongod or mongos instance.
main
Main package for the mongostat tool.
Main package for the mongostat tool.
Package mongotop provides a method to track the amount of time a MongoDB instance spends reading and writing data.
Package mongotop provides a method to track the amount of time a MongoDB instance spends reading and writing data.
main
Main package for the mongotop tool.
Main package for the mongotop tool.
aws
env

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL