Skip to content

Latest commit

 

History

History
47 lines (34 loc) · 1.28 KB

File metadata and controls

47 lines (34 loc) · 1.28 KB

PyWT

Python script to delve into MongoDB's WiredTiger data files

Requirements

  • pip install pymongo
  • pip install wiredtiger
  • pip install blessings

Please note that proper tooling is required to install the WiredTiger Python module. Please refer to the WiredTiger documentation for instructions on how to successfully compile WiredTiger.

Usage

usage: PyWT.py [-h] [--dbpath DBPATH] [--list] [--raw] [--pretty]
               [--table TABLE] [--export EXPORT] [--export-all]

optional arguments:
  -h, --help       show this help message and exit
  --dbpath DBPATH  dbpath (defaults to the current directory)
  --list           print MongoDB catalog content
  --raw            print raw data
  --pretty         pretty print documents
  --table TABLE    WT table to print
  --export EXPORT  MongoDB namespace to export
  --export-all     Export all MongoDB namespaces

Examples

List MongoDB namespace <-> WiredTiger tables:

PyWT.py --dbpath /data/db --list

Pretty print the contents of a specific WiredTiger table:

PyWT.py --table _mdb_catalog --pretty

Restore a specific MongoDB namespace to a running MongoDB instance:

PyWT.py --export test.collection | mongoimport -d test -c collection