MongoType
MongoDB Collection Data Dump with BSON Types
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
MongoType Utility

MongoType is a command line utility designed to dump out the contents of a MongoDB collection with the associated BSON data types.


Author
Mark Deazley <mdeaz.nosp@m.ley@.nosp@m.gmail.nosp@m..com>
Version
2.4.1

License

Free Software Foundation’s GNU AGPL v3.0.

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see http://www.gnu.org/licenses/ .


Hints:

  • This documentation is heavily hyperlinked: Navigate around to get a feel for the different views, .i.e., files, namespaces, classes, etc are all different views of the programs structure.
  • The colorized and hyperlinked program source code matching this version of the documentation is accessed by clicking on the line number links or the links on the file and class pages.

Summary of Operation:

main() Function:

The main() functionality is relatively simple:

mongotype NameSpace:

The mongotype namespace is where the majority of the code resides to avoid conflicts.

The mongotype::dumpCollection function:

This is a catch-all function that:

Command Line Parameter Parsing:

The mongotype::Parameters class uses the boost::program_options library to do the command line parsing, supplying initialization, validation overload functions, and getter access functions. While technically not an immutable class it functions as such in MongoType once command line parsing is completed.

Interface mongotype::IBSONRenderer:

All the concrete style implementation classes implement mongotype::IBSONRenderer to provide a polymorphic begin-render-end rendering sequence to create the output. This interface allows the style classes to customize the output but present a common interface .aka. API.

Interface mongotype::IBSONObjectVisitor:

All the concrete style implementation classes also implement mongotype::IBSONObjectVisitor to receive the events that are generated when a mongo::BSONObj object is parsed. This interface allows the style implementation classes to parse BSON objects via the common implementation class mongotype::BSONObjectParser.

BSON Object Parser: mongotype::BSONObjectParser

The mechanics of decomposing BSON objects is encapsulated in the mongotype::BSONObjectParser class which relies on mongotype::IBSONObjectVisitor implementors described below. It supplies the instance method mongotype::BSONObjectParser::parse as the entry point to initiate parsing of a mongo::BSONObj object.

Style Implementation Classes

The following classes implement mongotype::IBSONRenderer and mongotype::IBSONObjectVisitor as described above:

Utility Classes: