Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-release > by-pkgid > bc55833f04f370ac3ed453ef5b0ad686 > files > 263

python2-gridfs-3.7.2-1.mga7.i586.rpm


<!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="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>son_manipulator – Manipulators that can edit SON documents as they are saved or retrieved &#8212; PyMongo 3.7.2 documentation</title>
    <link rel="stylesheet" href="../../_static/pydoctheme.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></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/language_data.js"></script>
    
    <script type="text/javascript" src="../../_static/sidebar.js"></script>
    
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="uri_parser – Tools to parse and validate a MongoDB URI" href="uri_parser.html" />
    <link rel="prev" title="results – Result class definitions" href="results.html" /> 
  </head><body>
    <div class="related" role="navigation" aria-label="related navigation">
      <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="uri_parser.html" title="uri_parser – Tools to parse and validate a MongoDB URI"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="results.html" title="results – Result class definitions"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">PyMongo 3.7.2 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >API Documentation</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" accesskey="U"><code class="docutils literal notranslate"><span class="pre">pymongo</span></code> – Python driver for MongoDB</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="module-pymongo.son_manipulator">
<span id="son-manipulator-manipulators-that-can-edit-son-documents-as-they-are-saved-or-retrieved"></span><h1><code class="xref py py-mod docutils literal notranslate"><span class="pre">son_manipulator</span></code> – Manipulators that can edit SON documents as they are saved or retrieved<a class="headerlink" href="#module-pymongo.son_manipulator" title="Permalink to this headline">¶</a></h1>
<p><strong>DEPRECATED</strong>: Manipulators that can edit SON objects as they enter and exit
a database.</p>
<p>The <a class="reference internal" href="#pymongo.son_manipulator.SONManipulator" title="pymongo.son_manipulator.SONManipulator"><code class="xref py py-class docutils literal notranslate"><span class="pre">SONManipulator</span></code></a> API has limitations as a
technique for transforming your data. Instead, it is more flexible and
straightforward to transform outgoing documents in your own code before passing
them to PyMongo, and transform incoming documents after receiving them from
PyMongo. SON Manipulators will be removed from PyMongo in 4.0.</p>
<p>PyMongo does <strong>not</strong> apply SON manipulators to documents passed to
the modern methods <a class="reference internal" href="collection.html#pymongo.collection.Collection.bulk_write" title="pymongo.collection.Collection.bulk_write"><code class="xref py py-meth docutils literal notranslate"><span class="pre">bulk_write()</span></code></a>,
<a class="reference internal" href="collection.html#pymongo.collection.Collection.insert_one" title="pymongo.collection.Collection.insert_one"><code class="xref py py-meth docutils literal notranslate"><span class="pre">insert_one()</span></code></a>,
<a class="reference internal" href="collection.html#pymongo.collection.Collection.insert_many" title="pymongo.collection.Collection.insert_many"><code class="xref py py-meth docutils literal notranslate"><span class="pre">insert_many()</span></code></a>,
<a class="reference internal" href="collection.html#pymongo.collection.Collection.update_one" title="pymongo.collection.Collection.update_one"><code class="xref py py-meth docutils literal notranslate"><span class="pre">update_one()</span></code></a>, or
<a class="reference internal" href="collection.html#pymongo.collection.Collection.update_many" title="pymongo.collection.Collection.update_many"><code class="xref py py-meth docutils literal notranslate"><span class="pre">update_many()</span></code></a>. SON manipulators are
<strong>not</strong> applied to documents returned by the modern methods
<a class="reference internal" href="collection.html#pymongo.collection.Collection.find_one_and_delete" title="pymongo.collection.Collection.find_one_and_delete"><code class="xref py py-meth docutils literal notranslate"><span class="pre">find_one_and_delete()</span></code></a>,
<a class="reference internal" href="collection.html#pymongo.collection.Collection.find_one_and_replace" title="pymongo.collection.Collection.find_one_and_replace"><code class="xref py py-meth docutils literal notranslate"><span class="pre">find_one_and_replace()</span></code></a>, and
<a class="reference internal" href="collection.html#pymongo.collection.Collection.find_one_and_update" title="pymongo.collection.Collection.find_one_and_update"><code class="xref py py-meth docutils literal notranslate"><span class="pre">find_one_and_update()</span></code></a>.</p>
<dl class="class">
<dt id="pymongo.son_manipulator.AutoReference">
<em class="property">class </em><code class="descclassname">pymongo.son_manipulator.</code><code class="descname">AutoReference</code><span class="sig-paren">(</span><em>db</em><span class="sig-paren">)</span><a class="headerlink" href="#pymongo.son_manipulator.AutoReference" title="Permalink to this definition">¶</a></dt>
<dd><p>Transparently reference and de-reference already saved embedded objects.</p>
<p>This manipulator should probably only be used when the NamespaceInjector is
also being used, otherwise it doesn’t make too much sense - documents can
only be auto-referenced if they have an <em>_ns</em> field.</p>
<p>NOTE: this will behave poorly if you have a circular reference.</p>
<p>TODO: this only works for documents that are in the same database. To fix
this we’ll need to add a DatabaseInjector that adds <em>_db</em> and then make
use of the optional <em>database</em> support for DBRefs.</p>
<dl class="method">
<dt id="pymongo.son_manipulator.AutoReference.transform_incoming">
<code class="descname">transform_incoming</code><span class="sig-paren">(</span><em>son</em>, <em>collection</em><span class="sig-paren">)</span><a class="headerlink" href="#pymongo.son_manipulator.AutoReference.transform_incoming" title="Permalink to this definition">¶</a></dt>
<dd><p>Replace embedded documents with DBRefs.</p>
</dd></dl>

<dl class="method">
<dt id="pymongo.son_manipulator.AutoReference.transform_outgoing">
<code class="descname">transform_outgoing</code><span class="sig-paren">(</span><em>son</em>, <em>collection</em><span class="sig-paren">)</span><a class="headerlink" href="#pymongo.son_manipulator.AutoReference.transform_outgoing" title="Permalink to this definition">¶</a></dt>
<dd><p>Replace DBRefs with embedded documents.</p>
</dd></dl>

<dl class="method">
<dt id="pymongo.son_manipulator.AutoReference.will_copy">
<code class="descname">will_copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pymongo.son_manipulator.AutoReference.will_copy" title="Permalink to this definition">¶</a></dt>
<dd><p>We need to copy so the user’s document doesn’t get transformed refs.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pymongo.son_manipulator.NamespaceInjector">
<em class="property">class </em><code class="descclassname">pymongo.son_manipulator.</code><code class="descname">NamespaceInjector</code><a class="headerlink" href="#pymongo.son_manipulator.NamespaceInjector" title="Permalink to this definition">¶</a></dt>
<dd><p>A son manipulator that adds the _ns field.</p>
<dl class="method">
<dt id="pymongo.son_manipulator.NamespaceInjector.transform_incoming">
<code class="descname">transform_incoming</code><span class="sig-paren">(</span><em>son</em>, <em>collection</em><span class="sig-paren">)</span><a class="headerlink" href="#pymongo.son_manipulator.NamespaceInjector.transform_incoming" title="Permalink to this definition">¶</a></dt>
<dd><p>Add the _ns field to the incoming object</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pymongo.son_manipulator.ObjectIdInjector">
<em class="property">class </em><code class="descclassname">pymongo.son_manipulator.</code><code class="descname">ObjectIdInjector</code><a class="headerlink" href="#pymongo.son_manipulator.ObjectIdInjector" title="Permalink to this definition">¶</a></dt>
<dd><p>A son manipulator that adds the _id field if it is missing.</p>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 2.7: </span>ObjectIdInjector is no longer used by PyMongo, but remains in this
module for backwards compatibility.</p>
</div>
<dl class="method">
<dt id="pymongo.son_manipulator.ObjectIdInjector.transform_incoming">
<code class="descname">transform_incoming</code><span class="sig-paren">(</span><em>son</em>, <em>collection</em><span class="sig-paren">)</span><a class="headerlink" href="#pymongo.son_manipulator.ObjectIdInjector.transform_incoming" title="Permalink to this definition">¶</a></dt>
<dd><p>Add an _id field if it is missing.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pymongo.son_manipulator.ObjectIdShuffler">
<em class="property">class </em><code class="descclassname">pymongo.son_manipulator.</code><code class="descname">ObjectIdShuffler</code><a class="headerlink" href="#pymongo.son_manipulator.ObjectIdShuffler" title="Permalink to this definition">¶</a></dt>
<dd><p>A son manipulator that moves _id to the first position.</p>
<dl class="method">
<dt id="pymongo.son_manipulator.ObjectIdShuffler.transform_incoming">
<code class="descname">transform_incoming</code><span class="sig-paren">(</span><em>son</em>, <em>collection</em><span class="sig-paren">)</span><a class="headerlink" href="#pymongo.son_manipulator.ObjectIdShuffler.transform_incoming" title="Permalink to this definition">¶</a></dt>
<dd><p>Move _id to the front if it’s there.</p>
</dd></dl>

<dl class="method">
<dt id="pymongo.son_manipulator.ObjectIdShuffler.will_copy">
<code class="descname">will_copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pymongo.son_manipulator.ObjectIdShuffler.will_copy" title="Permalink to this definition">¶</a></dt>
<dd><p>We need to copy to be sure that we are dealing with SON, not a dict.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="pymongo.son_manipulator.SONManipulator">
<em class="property">class </em><code class="descclassname">pymongo.son_manipulator.</code><code class="descname">SONManipulator</code><a class="headerlink" href="#pymongo.son_manipulator.SONManipulator" title="Permalink to this definition">¶</a></dt>
<dd><p>A base son manipulator.</p>
<p>This manipulator just saves and restores objects without changing them.</p>
<dl class="method">
<dt id="pymongo.son_manipulator.SONManipulator.transform_incoming">
<code class="descname">transform_incoming</code><span class="sig-paren">(</span><em>son</em>, <em>collection</em><span class="sig-paren">)</span><a class="headerlink" href="#pymongo.son_manipulator.SONManipulator.transform_incoming" title="Permalink to this definition">¶</a></dt>
<dd><p>Manipulate an incoming SON object.</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>son</cite>: the SON object to be inserted into the database</li>
<li><cite>collection</cite>: the collection the object is being inserted into</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="pymongo.son_manipulator.SONManipulator.transform_outgoing">
<code class="descname">transform_outgoing</code><span class="sig-paren">(</span><em>son</em>, <em>collection</em><span class="sig-paren">)</span><a class="headerlink" href="#pymongo.son_manipulator.SONManipulator.transform_outgoing" title="Permalink to this definition">¶</a></dt>
<dd><p>Manipulate an outgoing SON object.</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>son</cite>: the SON object being retrieved from the database</li>
<li><cite>collection</cite>: the collection this object was stored in</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="pymongo.son_manipulator.SONManipulator.will_copy">
<code class="descname">will_copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#pymongo.son_manipulator.SONManipulator.will_copy" title="Permalink to this definition">¶</a></dt>
<dd><p>Will this SON manipulator make a copy of the incoming document?</p>
<p>Derived classes that do need to make a copy should override this
method, returning True instead of False. All non-copying manipulators
will be applied first (so that the user’s document will be updated
appropriately), followed by copying manipulators.</p>
</dd></dl>

</dd></dl>

</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h4>Previous topic</h4>
  <p class="topless"><a href="results.html"
                        title="previous chapter"><code class="docutils literal notranslate"><span class="pre">results</span></code> – Result class definitions</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="uri_parser.html"
                        title="next chapter"><code class="docutils literal notranslate"><span class="pre">uri_parser</span></code> – Tools to parse and validate a MongoDB URI</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/api/pymongo/son_manipulator.rst.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <div class="searchformwrapper">
    <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>
    </div>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <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="uri_parser.html" title="uri_parser – Tools to parse and validate a MongoDB URI"
             >next</a> |</li>
        <li class="right" >
          <a href="results.html" title="results – Result class definitions"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">PyMongo 3.7.2 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../index.html" >API Documentation</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="index.html" ><code class="docutils literal notranslate"><span class="pre">pymongo</span></code> – Python driver for MongoDB</a> &#187;</li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright MongoDB, Inc. 2008-present. MongoDB, Mongo, and the leaf logo are registered trademarks of MongoDB, Inc.
    </div>
  </body>
</html>