-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.txt
54 lines (31 loc) · 1.23 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Readme
==============================================================================
Usage
------------------------------------------------------------------------------
The bson_lazy package provides a `load()` function that lazily reads a
BSON file. The package also comes with a simple BSON to JSON utility.
Example usage:
::
import bson_lazy
from bson.json_util import dumps
def json_pprint(doc):
print dumps(doc, sort_keys=True, indent=4, separators=(',',':'))
with open('sample.bson', 'rb') as f:
for doc in bson_lazy.load(f):
json_pprint(doc)
The implementation of `bson_lazy.load()` is based on PyMongo's bson package.
Installation
------------------------------------------------------------------------------
This package can be installed using `pip`:
::
pip install https://github.com/ShinNoNoir/bson_lazy/archive/master.zip
Or:
::
pip install -e git://github.com/ShinNoNoir/bson_lazy.git#egg=bson_lazy
Usage of `bson2json.py`
------------------------------------------------------------------------------
This utility displays BSON files to stdout.
Usage: `bson2json.py FILE... [OPTIONS]`
Options:
--pretty Pretty print JSON
--help Print this help message