/usr/share/doc/python-pymongo-doc/html/api/bson/index.html is in python-pymongo-doc 2.7.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>bson – BSON (Binary JSON) Encoding and Decoding — PyMongo 2.7.2 documentation</title>
<link rel="stylesheet" href="../../_static/default.css" type="text/css" />
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../../',
VERSION: '2.7.2',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../../_static/jquery.js"></script>
<script type="text/javascript" src="../../_static/underscore.js"></script>
<script type="text/javascript" src="../../_static/doctools.js"></script>
<script type="text/javascript" src="../../_static/sidebar.js"></script>
<link rel="top" title="PyMongo 2.7.2 documentation" href="../../index.html" />
<link rel="up" title="API Documentation" href="../index.html" />
<link rel="next" title="binary – Tools for representing binary data to be stored in MongoDB" href="binary.html" />
<link rel="prev" title="API Documentation" href="../index.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="binary.html" title="binary – Tools for representing binary data to be stored in MongoDB"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="../index.html" title="API Documentation"
accesskey="P">previous</a> |</li>
<li><a href="../../index.html">PyMongo 2.7.2 documentation</a> »</li>
<li><a href="../index.html" accesskey="U">API Documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-bson">
<span id="bson-bson-binary-json-encoding-and-decoding"></span><h1><a class="reference internal" href="#module-bson" title="bson: BSON (Binary JSON) Encoding and Decoding"><tt class="xref py py-mod docutils literal"><span class="pre">bson</span></tt></a> – BSON (Binary JSON) Encoding and Decoding<a class="headerlink" href="#module-bson" title="Permalink to this headline">¶</a></h1>
<p>BSON (Binary JSON) encoding and decoding.</p>
<dl class="class">
<dt id="bson.BSON">
<em class="property">class </em><tt class="descclassname">bson.</tt><tt class="descname">BSON</tt><a class="headerlink" href="#bson.BSON" title="Permalink to this definition">¶</a></dt>
<dd><p>BSON (Binary JSON) data.</p>
<dl class="method">
<dt id="bson.BSON.decode">
<tt class="descname">decode</tt><big>(</big><em>as_class=<type 'dict'></em>, <em>tz_aware=False</em>, <em>uuid_subtype=3</em>, <em>compile_re=True</em><big>)</big><a class="headerlink" href="#bson.BSON.decode" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode this BSON data.</p>
<p>The default type to use for the resultant document is
<tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt>. Any other class that supports
<tt class="xref py py-meth docutils literal"><span class="pre">__setitem__()</span></tt> can be used instead by passing it as the
<cite>as_class</cite> parameter.</p>
<p>If <cite>tz_aware</cite> is <tt class="docutils literal"><span class="pre">True</span></tt> (recommended), any
<tt class="xref py py-class docutils literal"><span class="pre">datetime</span></tt> instances returned will be
timezone-aware, with their timezone set to
<a class="reference internal" href="tz_util.html#bson.tz_util.utc" title="bson.tz_util.utc"><tt class="xref py py-attr docutils literal"><span class="pre">bson.tz_util.utc</span></tt></a>. Otherwise (default), all
<tt class="xref py py-class docutils literal"><span class="pre">datetime</span></tt> instances will be naive (but
contain UTC).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><cite>as_class</cite> (optional): the class to use for the resulting
document</li>
<li><cite>tz_aware</cite> (optional): if <tt class="docutils literal"><span class="pre">True</span></tt>, return timezone-aware
<tt class="xref py py-class docutils literal"><span class="pre">datetime</span></tt> instances</li>
<li><cite>compile_re</cite> (optional): if <tt class="docutils literal"><span class="pre">False</span></tt>, don’t attempt to compile
BSON regular expressions into Python regular expressions. Return
instances of
<a class="reference internal" href="regex.html#bson.regex.Regex" title="bson.regex.Regex"><tt class="xref py py-class docutils literal"><span class="pre">Regex</span></tt></a> instead. Can avoid
<a class="reference internal" href="errors.html#bson.errors.InvalidBSON" title="bson.errors.InvalidBSON"><tt class="xref py py-exc docutils literal"><span class="pre">InvalidBSON</span></tt></a> errors when receiving
Python-incompatible regular expressions, for example from
<tt class="docutils literal"><span class="pre">currentOp</span></tt></li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 2.7: </span>Added <tt class="docutils literal"><span class="pre">compile_re</span></tt> option.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 1.9.</span></p>
</div>
</dd></dl>
<dl class="classmethod">
<dt id="bson.BSON.encode">
<em class="property">classmethod </em><tt class="descname">encode</tt><big>(</big><em>document</em>, <em>check_keys=False</em>, <em>uuid_subtype=3</em><big>)</big><a class="headerlink" href="#bson.BSON.encode" title="Permalink to this definition">¶</a></dt>
<dd><p>Encode a document to a new <a class="reference internal" href="#bson.BSON" title="bson.BSON"><tt class="xref py py-class docutils literal"><span class="pre">BSON</span></tt></a> instance.</p>
<p>A document can be any mapping type (like <tt class="xref py py-class docutils literal"><span class="pre">dict</span></tt>).</p>
<p>Raises <tt class="xref py py-class docutils literal"><span class="pre">TypeError</span></tt> if <cite>document</cite> is not a mapping type,
or contains keys that are not instances of
<tt class="xref py py-class docutils literal"><span class="pre">basestring</span></tt> (<tt class="xref py py-class docutils literal"><span class="pre">str</span></tt> in python 3). Raises
<a class="reference internal" href="errors.html#bson.errors.InvalidDocument" title="bson.errors.InvalidDocument"><tt class="xref py py-class docutils literal"><span class="pre">InvalidDocument</span></tt></a> if <cite>document</cite> cannot be
converted to <a class="reference internal" href="#bson.BSON" title="bson.BSON"><tt class="xref py py-class docutils literal"><span class="pre">BSON</span></tt></a>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><cite>document</cite>: mapping type representing a document</li>
<li><cite>check_keys</cite> (optional): check if keys start with ‘$’ or
contain ‘.’, raising <a class="reference internal" href="errors.html#bson.errors.InvalidDocument" title="bson.errors.InvalidDocument"><tt class="xref py py-class docutils literal"><span class="pre">InvalidDocument</span></tt></a> in
either case</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="versionadded">
<p><span class="versionmodified">New in version 1.9.</span></p>
</div>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="bson.decode_all">
<tt class="descclassname">bson.</tt><tt class="descname">decode_all</tt><big>(</big><em>data</em>, <em>as_class=<type 'dict'></em>, <em>tz_aware=True</em>, <em>uuid_subtype=3</em>, <em>compile_re=True</em><big>)</big><a class="headerlink" href="#bson.decode_all" title="Permalink to this definition">¶</a></dt>
<dd><p>Decode BSON data to multiple documents.</p>
<p><cite>data</cite> must be a string of concatenated, valid, BSON-encoded
documents.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><cite>data</cite>: BSON data</li>
<li><cite>as_class</cite> (optional): the class to use for the resulting
documents</li>
<li><cite>tz_aware</cite> (optional): if <tt class="docutils literal"><span class="pre">True</span></tt>, return timezone-aware
<tt class="xref py py-class docutils literal"><span class="pre">datetime</span></tt> instances</li>
<li><cite>compile_re</cite> (optional): if <tt class="docutils literal"><span class="pre">False</span></tt>, don’t attempt to compile
BSON regular expressions into Python regular expressions. Return
instances of <a class="reference internal" href="regex.html#bson.regex.Regex" title="bson.regex.Regex"><tt class="xref py py-class docutils literal"><span class="pre">Regex</span></tt></a> instead. Can avoid
<a class="reference internal" href="errors.html#bson.errors.InvalidBSON" title="bson.errors.InvalidBSON"><tt class="xref py py-exc docutils literal"><span class="pre">InvalidBSON</span></tt></a> errors when receiving
Python-incompatible regular expressions, for example from <tt class="docutils literal"><span class="pre">currentOp</span></tt></li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 2.7: </span>Added <cite>compile_re</cite> option.</p>
</div>
<div class="versionadded">
<p><span class="versionmodified">New in version 1.9.</span></p>
</div>
</dd></dl>
<dl class="function">
<dt id="bson.has_c">
<tt class="descclassname">bson.</tt><tt class="descname">has_c</tt><big>(</big><big>)</big><a class="headerlink" href="#bson.has_c" title="Permalink to this definition">¶</a></dt>
<dd><p>Is the C extension installed?</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 1.9.</span></p>
</div>
</dd></dl>
<dl class="function">
<dt id="bson.has_uuid">
<tt class="descclassname">bson.</tt><tt class="descname">has_uuid</tt><big>(</big><big>)</big><a class="headerlink" href="#bson.has_uuid" title="Permalink to this definition">¶</a></dt>
<dd><p>Is the uuid module available?</p>
<div class="versionadded">
<p><span class="versionmodified">New in version 2.3.</span></p>
</div>
</dd></dl>
<dl class="function">
<dt id="bson.is_valid">
<tt class="descclassname">bson.</tt><tt class="descname">is_valid</tt><big>(</big><em>bson</em><big>)</big><a class="headerlink" href="#bson.is_valid" title="Permalink to this definition">¶</a></dt>
<dd><p>Check that the given string represents valid <a class="reference internal" href="#bson.BSON" title="bson.BSON"><tt class="xref py py-class docutils literal"><span class="pre">BSON</span></tt></a> data.</p>
<p>Raises <tt class="xref py py-class docutils literal"><span class="pre">TypeError</span></tt> if <cite>bson</cite> is not an instance of
<tt class="xref py py-class docutils literal"><span class="pre">str</span></tt> (<tt class="xref py py-class docutils literal"><span class="pre">bytes</span></tt> in python 3). Returns <tt class="docutils literal"><span class="pre">True</span></tt>
if <cite>bson</cite> is valid <a class="reference internal" href="#bson.BSON" title="bson.BSON"><tt class="xref py py-class docutils literal"><span class="pre">BSON</span></tt></a>, <tt class="docutils literal"><span class="pre">False</span></tt> otherwise.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><cite>bson</cite>: the data to be validated</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<p>Sub-modules:</p>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="binary.html"><tt class="docutils literal"><span class="pre">binary</span></tt> – Tools for representing binary data to be stored in MongoDB</a></li>
<li class="toctree-l1"><a class="reference internal" href="regex.html"><tt class="docutils literal"><span class="pre">regex</span></tt> – Tools for representing MongoDB regular expressions</a></li>
<li class="toctree-l1"><a class="reference internal" href="code.html"><tt class="docutils literal"><span class="pre">code</span></tt> – Tools for representing JavaScript code</a></li>
<li class="toctree-l1"><a class="reference internal" href="dbref.html"><tt class="docutils literal"><span class="pre">dbref</span></tt> – Tools for manipulating DBRefs (references to documents stored in MongoDB)</a></li>
<li class="toctree-l1"><a class="reference internal" href="errors.html"><tt class="docutils literal"><span class="pre">errors</span></tt> – Exceptions raised by the <tt class="docutils literal"><span class="pre">bson</span></tt> package</a></li>
<li class="toctree-l1"><a class="reference internal" href="json_util.html"><tt class="docutils literal"><span class="pre">json_util</span></tt> – Tools for using Python’s <tt class="docutils literal"><span class="pre">json</span></tt> module with BSON documents</a></li>
<li class="toctree-l1"><a class="reference internal" href="max_key.html"><tt class="docutils literal"><span class="pre">max_key</span></tt> – Representation for the MongoDB internal MaxKey type</a></li>
<li class="toctree-l1"><a class="reference internal" href="min_key.html"><tt class="docutils literal"><span class="pre">min_key</span></tt> – Representation for the MongoDB internal MinKey type</a></li>
<li class="toctree-l1"><a class="reference internal" href="objectid.html"><tt class="docutils literal"><span class="pre">objectid</span></tt> – Tools for working with MongoDB ObjectIds</a></li>
<li class="toctree-l1"><a class="reference internal" href="son.html"><tt class="docutils literal"><span class="pre">son</span></tt> – Tools for working with SON, an ordered mapping</a></li>
<li class="toctree-l1"><a class="reference internal" href="timestamp.html"><tt class="docutils literal"><span class="pre">timestamp</span></tt> – Tools for representing MongoDB internal Timestamps</a></li>
<li class="toctree-l1"><a class="reference internal" href="tz_util.html"><tt class="docutils literal"><span class="pre">tz_util</span></tt> – Utilities for dealing with timezones in Python</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h4>Previous topic</h4>
<p class="topless"><a href="../index.html"
title="previous chapter">API Documentation</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="binary.html"
title="next chapter"><tt class="docutils literal"><span class="pre">binary</span></tt> – Tools for representing binary data to be stored in MongoDB</a></p>
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../_sources/api/bson/index.txt"
rel="nofollow">Show Source</a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../../search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="../../py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="binary.html" title="binary – Tools for representing binary data to be stored in MongoDB"
>next</a> |</li>
<li class="right" >
<a href="../index.html" title="API Documentation"
>previous</a> |</li>
<li><a href="../../index.html">PyMongo 2.7.2 documentation</a> »</li>
<li><a href="../index.html" >API Documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2008 - 2014, MongoDB, Inc..
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2.3.
</div>
</body>
</html>
|