mongodump

package
v0.0.0-...-ac81b06 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2015 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package mongodump creates BSON data from the contents of a MongoDB instance.

Index

Constants

This section is empty.

Variables

View Source
var Usage = `` /* 249-byte string literal not displayed */

Functions

This section is empty.

Types

type IndexDocumentFromDB

type IndexDocumentFromDB struct {
	Options bson.M `bson:",inline"`
	Key     bson.D `bson:"key"`
}

IndexDocumentFromDB is used internally to preserve key ordering.

type InputOptions

type InputOptions struct {
	Query     string `long:"query" short:"q" description:"query filter, as a JSON string, e.g., '{x:{$gt:1}}'"`
	TableScan bool   `long:"forceTableScan" description:"force a table scan"`
}

InputOptions defines the set of options to use in retrieving data from the server.

func (*InputOptions) Name

func (_ *InputOptions) Name() string

Name returns a human-readable group name for input options.

type Metadata

type Metadata struct {
	Options interface{}   `json:"options,omitempty"`
	Indexes []interface{} `json:"indexes"`
}

Metadata holds information about a collection's options and indexes.

type MongoDump

type MongoDump struct {
	// basic mongo tool options
	ToolOptions   *options.ToolOptions
	InputOptions  *InputOptions
	OutputOptions *OutputOptions
	// contains filtered or unexported fields
}

MongoDump is a container for the user-specified options and internal state used for running mongodump.

func (*MongoDump) CreateAllIntents

func (dump *MongoDump) CreateAllIntents() error

CreateAllIntents iterates through all dbs and collections and builds dump intents for each collection.

func (*MongoDump) CreateCollectionIntent

func (dump *MongoDump) CreateCollectionIntent(dbName, colName string) error

CreateCollectionIntent builds an intent for a given collection and puts it into the intent manager.

func (*MongoDump) CreateIntentsForDatabase

func (dump *MongoDump) CreateIntentsForDatabase(dbName string) error

CreateIntentsForDatabase iterates through collections in a db and builds dump intents for each collection.

func (*MongoDump) CreateOplogIntents

func (dump *MongoDump) CreateOplogIntents() error

CreateOplogIntents creates an intents.Intent for the oplog and adds it to the manager

func (*MongoDump) CreateUsersRolesVersionIntentsForDB

func (dump *MongoDump) CreateUsersRolesVersionIntentsForDB(db string) error

CreateUsersRolesVersionIntentsForDB create intents to be written in to the specific database folder, for the users, roles and version admin database collections And then it adds the intents in to the manager

func (*MongoDump) Dump

func (dump *MongoDump) Dump() (err error)

Dump handles some final options checking and executes MongoDump.

func (*MongoDump) DumpIntent

func (dump *MongoDump) DumpIntent(intent *intents.Intent) error

DumpIntent dumps the specified database's collection.

func (*MongoDump) DumpIntents

func (dump *MongoDump) DumpIntents() error

DumpIntents iterates through the previously-created intents and dumps all of the found collections.

func (*MongoDump) DumpMetadata

func (dump *MongoDump) DumpMetadata() error

DumpMetadata dumps the metadata for each intent in the manager that has metadata

func (*MongoDump) DumpOplogAfterTimestamp

func (dump *MongoDump) DumpOplogAfterTimestamp(ts bson.MongoTimestamp) error

DumpOplogAfterTimestamp takes a timestamp and writer and dumps all oplog entries after the given timestamp to the writer. Returns any errors that occur.

func (*MongoDump) DumpSystemIndexes

func (dump *MongoDump) DumpSystemIndexes() error

DumpSystemIndexes dumps all of the system.indexes

func (*MongoDump) DumpUsersAndRoles

func (dump *MongoDump) DumpUsersAndRoles() error

DumpUsersAndRoles dumps all of the users and roles and versions TODO: This and DumpUsersAndRolesForDB should be merged, correctly

func (*MongoDump) DumpUsersAndRolesForDB

func (dump *MongoDump) DumpUsersAndRolesForDB(db string) error

DumpUsersAndRolesForDB queries and dumps the users and roles tied to the given database. Only works with an authentication schema version >= 3.

func (*MongoDump) Init

func (dump *MongoDump) Init() error

Init performs preliminary setup operations for MongoDump.

func (*MongoDump) NewIntent

func (dump *MongoDump) NewIntent(dbName, colName string, stdout bool) (*intents.Intent, error)

NewIntent creates a bare intent without populating the options.

func (*MongoDump) ValidateOptions

func (dump *MongoDump) ValidateOptions() error

ValidateOptions checks for any incompatible sets of options.

type OutputOptions

type OutputOptions struct {
	Out                        string   `long:"out" short:"o" description:"output directory, or '-' for stdout (defaults to 'dump')" default-mask:"-"`
	Gzip                       bool     `long:"gzip" description:"compress archive our collection output with Gzip"`
	Repair                     bool     `long:"repair" description:"try to recover documents from damaged data files (not supported by all storage engines)"`
	Oplog                      bool     `long:"oplog" description:"use oplog for taking a point-in-time snapshot"`
	Archive                    string   `long:"archive" optional:"true" optional-value:"-" description:"dump in to the specified dump-archive instead of a directory"`
	DumpDBUsersAndRoles        bool     `long:"dumpDbUsersAndRoles" description:"dump user and role definitions for the specified database"`
	ExcludedCollections        []string `` /* 142-byte string literal not displayed */
	ExcludedCollectionPrefixes []string `` /* 179-byte string literal not displayed */
}

OutputOptions defines the set of options for writing dump data.

func (*OutputOptions) Name

func (_ *OutputOptions) Name() string

Name returns a human-readable group name for output options.

Directories

Path Synopsis
Main package for the mongodump tool.
Main package for the mongodump tool.

Jump to

Keyboard shortcuts

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