Sophie

Sophie

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

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>grid_file – Tools for representing files stored in GridFS &#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="Tools" href="../../tools.html" />
    <link rel="prev" title="errors – Exceptions raised by the gridfs package" href="errors.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="../../tools.html" title="Tools"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="errors.html" title="errors – Exceptions raised by the gridfs package"
             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">gridfs</span></code> – Tools for working with GridFS</a> &#187;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="module-gridfs.grid_file">
<span id="grid-file-tools-for-representing-files-stored-in-gridfs"></span><h1><code class="xref py py-mod docutils literal notranslate"><span class="pre">grid_file</span></code> – Tools for representing files stored in GridFS<a class="headerlink" href="#module-gridfs.grid_file" title="Permalink to this headline">¶</a></h1>
<p>Tools for representing files stored in GridFS.</p>
<dl class="class">
<dt id="gridfs.grid_file.GridIn">
<em class="property">class </em><code class="descclassname">gridfs.grid_file.</code><code class="descname">GridIn</code><span class="sig-paren">(</span><em>root_collection</em>, <em>session=None</em>, <em>disable_md5=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridIn" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a file to GridFS</p>
<p>Application developers should generally not need to
instantiate this class directly - instead see the methods
provided by <a class="reference internal" href="index.html#gridfs.GridFS" title="gridfs.GridFS"><code class="xref py py-class docutils literal notranslate"><span class="pre">GridFS</span></code></a>.</p>
<p>Raises <code class="xref py py-class docutils literal notranslate"><span class="pre">TypeError</span></code> if <cite>root_collection</cite> is not an
instance of <a class="reference internal" href="../pymongo/collection.html#pymongo.collection.Collection" title="pymongo.collection.Collection"><code class="xref py py-class docutils literal notranslate"><span class="pre">Collection</span></code></a>.</p>
<p>Any of the file level options specified in the <a class="reference external" href="http://dochub.mongodb.org/core/gridfsspec">GridFS Spec</a> may be passed as
keyword arguments. Any additional keyword arguments will be
set as additional fields on the file document. Valid keyword
arguments include:</p>
<blockquote>
<div><ul class="simple">
<li><code class="docutils literal notranslate"><span class="pre">&quot;_id&quot;</span></code>: unique ID for this file (default:
<a class="reference internal" href="../bson/objectid.html#bson.objectid.ObjectId" title="bson.objectid.ObjectId"><code class="xref py py-class docutils literal notranslate"><span class="pre">ObjectId</span></code></a>) - this <code class="docutils literal notranslate"><span class="pre">&quot;_id&quot;</span></code> must
not have already been used for another file</li>
<li><code class="docutils literal notranslate"><span class="pre">&quot;filename&quot;</span></code>: human name for the file</li>
<li><code class="docutils literal notranslate"><span class="pre">&quot;contentType&quot;</span></code> or <code class="docutils literal notranslate"><span class="pre">&quot;content_type&quot;</span></code>: valid mime-type
for the file</li>
<li><code class="docutils literal notranslate"><span class="pre">&quot;chunkSize&quot;</span></code> or <code class="docutils literal notranslate"><span class="pre">&quot;chunk_size&quot;</span></code>: size of each of the
chunks, in bytes (default: 255 kb)</li>
<li><code class="docutils literal notranslate"><span class="pre">&quot;encoding&quot;</span></code>: encoding used for this file. In Python 2,
any <code class="xref py py-class docutils literal notranslate"><span class="pre">unicode</span></code> that is written to the file will be
converted to a <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>. In Python 3, any <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code>
that is written to the file will be converted to
<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>.</li>
</ul>
</div></blockquote>
<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>root_collection</cite>: root collection to write to</li>
<li><cite>session</cite> (optional): a
<a class="reference internal" href="../pymongo/client_session.html#pymongo.client_session.ClientSession" title="pymongo.client_session.ClientSession"><code class="xref py py-class docutils literal notranslate"><span class="pre">ClientSession</span></code></a> to use for all
commands</li>
<li><cite>disable_md5</cite> (optional): When True, an MD5 checksum will not be
computed for the uploaded file. Useful in environments where
MD5 cannot be used for regulatory or other reasons. Defaults to
False.</li>
<li><cite>**kwargs</cite> (optional): file level options (see above)</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 3.6: </span>Added <code class="docutils literal notranslate"><span class="pre">session</span></code> parameter.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 3.0: </span><cite>root_collection</cite> must use an acknowledged
<a class="reference internal" href="../pymongo/collection.html#pymongo.collection.Collection.write_concern" title="pymongo.collection.Collection.write_concern"><code class="xref py py-attr docutils literal notranslate"><span class="pre">write_concern</span></code></a></p>
</div>
<dl class="attribute">
<dt id="gridfs.grid_file.GridIn._id">
<code class="descname">_id</code><a class="headerlink" href="#gridfs.grid_file.GridIn._id" title="Permalink to this definition">¶</a></dt>
<dd><p>The <code class="docutils literal notranslate"><span class="pre">'_id'</span></code> value for this file.</p>
<p>This attribute is read-only.</p>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridIn.abort">
<code class="descname">abort</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridIn.abort" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove all chunks/files that may have been uploaded and close.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridIn.chunk_size">
<code class="descname">chunk_size</code><a class="headerlink" href="#gridfs.grid_file.GridIn.chunk_size" title="Permalink to this definition">¶</a></dt>
<dd><p>Chunk size for this file.</p>
<p>This attribute is read-only.</p>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridIn.close">
<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridIn.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Flush the file and close it.</p>
<p>A closed file cannot be written any more. Calling
<a class="reference internal" href="#gridfs.grid_file.GridIn.close" title="gridfs.grid_file.GridIn.close"><code class="xref py py-meth docutils literal notranslate"><span class="pre">close()</span></code></a> more than once is allowed.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridIn.closed">
<code class="descname">closed</code><a class="headerlink" href="#gridfs.grid_file.GridIn.closed" title="Permalink to this definition">¶</a></dt>
<dd><p>Is this file closed?</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridIn.content_type">
<code class="descname">content_type</code><a class="headerlink" href="#gridfs.grid_file.GridIn.content_type" title="Permalink to this definition">¶</a></dt>
<dd><p>Mime-type for this file.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridIn.filename">
<code class="descname">filename</code><a class="headerlink" href="#gridfs.grid_file.GridIn.filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Name of this file.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridIn.length">
<code class="descname">length</code><a class="headerlink" href="#gridfs.grid_file.GridIn.length" title="Permalink to this definition">¶</a></dt>
<dd><p>Length (in bytes) of this file.</p>
<p>This attribute is read-only and can only be read after <a class="reference internal" href="#gridfs.grid_file.GridIn.close" title="gridfs.grid_file.GridIn.close"><code class="xref py py-meth docutils literal notranslate"><span class="pre">close()</span></code></a> has been called.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridIn.md5">
<code class="descname">md5</code><a class="headerlink" href="#gridfs.grid_file.GridIn.md5" title="Permalink to this definition">¶</a></dt>
<dd><p>MD5 of the contents of this file if an md5 sum was created.</p>
<p>This attribute is read-only and can only be read after <a class="reference internal" href="#gridfs.grid_file.GridIn.close" title="gridfs.grid_file.GridIn.close"><code class="xref py py-meth docutils literal notranslate"><span class="pre">close()</span></code></a> has been called.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridIn.name">
<code class="descname">name</code><a class="headerlink" href="#gridfs.grid_file.GridIn.name" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for <cite>filename</cite>.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridIn.upload_date">
<code class="descname">upload_date</code><a class="headerlink" href="#gridfs.grid_file.GridIn.upload_date" title="Permalink to this definition">¶</a></dt>
<dd><p>Date that this file was uploaded.</p>
<p>This attribute is read-only and can only be read after <a class="reference internal" href="#gridfs.grid_file.GridIn.close" title="gridfs.grid_file.GridIn.close"><code class="xref py py-meth docutils literal notranslate"><span class="pre">close()</span></code></a> has been called.</p>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridIn.write">
<code class="descname">write</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridIn.write" title="Permalink to this definition">¶</a></dt>
<dd><p>Write data to the file. There is no return value.</p>
<p><cite>data</cite> can be either a string of bytes or a file-like object
(implementing <code class="xref py py-meth docutils literal notranslate"><span class="pre">read()</span></code>). If the file has an
<code class="xref py py-attr docutils literal notranslate"><span class="pre">encoding</span></code> attribute, <cite>data</cite> can also be a
<code class="xref py py-class docutils literal notranslate"><span class="pre">unicode</span></code> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code> in python 3) instance, which
will be encoded as <code class="xref py py-attr docutils literal notranslate"><span class="pre">encoding</span></code> before being written.</p>
<p>Due to buffering, the data may not actually be written to the
database until the <a class="reference internal" href="#gridfs.grid_file.GridIn.close" title="gridfs.grid_file.GridIn.close"><code class="xref py py-meth docutils literal notranslate"><span class="pre">close()</span></code></a> method is called. Raises
<code class="xref py py-class docutils literal notranslate"><span class="pre">ValueError</span></code> if this file is already closed. Raises
<code class="xref py py-class docutils literal notranslate"><span class="pre">TypeError</span></code> if <cite>data</cite> is not an instance of
<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code> in python 3), a file-like object,
or an instance of <code class="xref py py-class docutils literal notranslate"><span class="pre">unicode</span></code> (<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code> in python 3).
Unicode data is only allowed if the file has an <code class="xref py py-attr docutils literal notranslate"><span class="pre">encoding</span></code>
attribute.</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>: string of bytes or file-like object to be written
to the file</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridIn.writelines">
<code class="descname">writelines</code><span class="sig-paren">(</span><em>sequence</em><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridIn.writelines" title="Permalink to this definition">¶</a></dt>
<dd><p>Write a sequence of strings to the file.</p>
<p>Does not add seperators.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gridfs.grid_file.GridOut">
<em class="property">class </em><code class="descclassname">gridfs.grid_file.</code><code class="descname">GridOut</code><span class="sig-paren">(</span><em>root_collection</em>, <em>file_id=None</em>, <em>file_document=None</em>, <em>session=None</em><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridOut" title="Permalink to this definition">¶</a></dt>
<dd><p>Read a file from GridFS</p>
<p>Application developers should generally not need to
instantiate this class directly - instead see the methods
provided by <a class="reference internal" href="index.html#gridfs.GridFS" title="gridfs.GridFS"><code class="xref py py-class docutils literal notranslate"><span class="pre">GridFS</span></code></a>.</p>
<p>Either <cite>file_id</cite> or <cite>file_document</cite> must be specified,
<cite>file_document</cite> will be given priority if present. Raises
<code class="xref py py-class docutils literal notranslate"><span class="pre">TypeError</span></code> if <cite>root_collection</cite> is not an instance of
<a class="reference internal" href="../pymongo/collection.html#pymongo.collection.Collection" title="pymongo.collection.Collection"><code class="xref py py-class docutils literal notranslate"><span class="pre">Collection</span></code></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>root_collection</cite>: root collection to read from</li>
<li><cite>file_id</cite> (optional): value of <code class="docutils literal notranslate"><span class="pre">&quot;_id&quot;</span></code> for the file to read</li>
<li><cite>file_document</cite> (optional): file document from
<cite>root_collection.files</cite></li>
<li><cite>session</cite> (optional): a
<a class="reference internal" href="../pymongo/client_session.html#pymongo.client_session.ClientSession" title="pymongo.client_session.ClientSession"><code class="xref py py-class docutils literal notranslate"><span class="pre">ClientSession</span></code></a> to use for all
commands</li>
</ul>
</td>
</tr>
</tbody>
</table>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 3.6: </span>Added <code class="docutils literal notranslate"><span class="pre">session</span></code> parameter.</p>
</div>
<div class="versionchanged">
<p><span class="versionmodified">Changed in version 3.0: </span>Creating a GridOut does not immediately retrieve the file metadata
from the server. Metadata is fetched when first needed.</p>
</div>
<dl class="attribute">
<dt id="gridfs.grid_file.GridOut._id">
<code class="descname">_id</code><a class="headerlink" href="#gridfs.grid_file.GridOut._id" title="Permalink to this definition">¶</a></dt>
<dd><p>The <code class="docutils literal notranslate"><span class="pre">'_id'</span></code> value for this file.</p>
<p>This attribute is read-only.</p>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridOut.__iter__">
<code class="descname">__iter__</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridOut.__iter__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return an iterator over all of this file’s data.</p>
<p>The iterator will return chunk-sized instances of
<code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code> in python 3). This can be
useful when serving files using a webserver that handles
such an iterator efficiently.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridOut.aliases">
<code class="descname">aliases</code><a class="headerlink" href="#gridfs.grid_file.GridOut.aliases" title="Permalink to this definition">¶</a></dt>
<dd><p>List of aliases for this file.</p>
<p>This attribute is read-only.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridOut.chunk_size">
<code class="descname">chunk_size</code><a class="headerlink" href="#gridfs.grid_file.GridOut.chunk_size" title="Permalink to this definition">¶</a></dt>
<dd><p>Chunk size for this file.</p>
<p>This attribute is read-only.</p>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridOut.close">
<code class="descname">close</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridOut.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Make GridOut more generically file-like.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridOut.content_type">
<code class="descname">content_type</code><a class="headerlink" href="#gridfs.grid_file.GridOut.content_type" title="Permalink to this definition">¶</a></dt>
<dd><p>Mime-type for this file.</p>
<p>This attribute is read-only.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridOut.filename">
<code class="descname">filename</code><a class="headerlink" href="#gridfs.grid_file.GridOut.filename" title="Permalink to this definition">¶</a></dt>
<dd><p>Name of this file.</p>
<p>This attribute is read-only.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridOut.length">
<code class="descname">length</code><a class="headerlink" href="#gridfs.grid_file.GridOut.length" title="Permalink to this definition">¶</a></dt>
<dd><p>Length (in bytes) of this file.</p>
<p>This attribute is read-only.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridOut.md5">
<code class="descname">md5</code><a class="headerlink" href="#gridfs.grid_file.GridOut.md5" title="Permalink to this definition">¶</a></dt>
<dd><p>MD5 of the contents of this file if an md5 sum was created.</p>
<p>This attribute is read-only.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridOut.metadata">
<code class="descname">metadata</code><a class="headerlink" href="#gridfs.grid_file.GridOut.metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Metadata attached to this file.</p>
<p>This attribute is read-only.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridOut.name">
<code class="descname">name</code><a class="headerlink" href="#gridfs.grid_file.GridOut.name" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for <cite>filename</cite>.</p>
<p>This attribute is read-only.</p>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridOut.read">
<code class="descname">read</code><span class="sig-paren">(</span><em>size=-1</em><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridOut.read" title="Permalink to this definition">¶</a></dt>
<dd><p>Read at most <cite>size</cite> bytes from the file (less if there
isn’t enough data).</p>
<p>The bytes are returned as an instance of <code class="xref py py-class docutils literal notranslate"><span class="pre">str</span></code> (<code class="xref py py-class docutils literal notranslate"><span class="pre">bytes</span></code>
in python 3). If <cite>size</cite> is negative or omitted all data is read.</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>size</cite> (optional): the number of bytes to read</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridOut.readchunk">
<code class="descname">readchunk</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridOut.readchunk" title="Permalink to this definition">¶</a></dt>
<dd><p>Reads a chunk at a time. If the current position is within a
chunk the remainder of the chunk is returned.</p>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridOut.readline">
<code class="descname">readline</code><span class="sig-paren">(</span><em>size=-1</em><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridOut.readline" title="Permalink to this definition">¶</a></dt>
<dd><p>Read one line or up to <cite>size</cite> bytes from the file.</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>size</cite> (optional): the maximum number of bytes to read</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridOut.seek">
<code class="descname">seek</code><span class="sig-paren">(</span><em>pos</em>, <em>whence=0</em><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridOut.seek" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the current position of this file.</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>pos</cite>: the position (or offset if using relative
positioning) to seek to</li>
<li><cite>whence</cite> (optional): where to seek
from. <code class="xref py py-attr docutils literal notranslate"><span class="pre">os.SEEK_SET</span></code> (<code class="docutils literal notranslate"><span class="pre">0</span></code>) for absolute file
positioning, <code class="xref py py-attr docutils literal notranslate"><span class="pre">os.SEEK_CUR</span></code> (<code class="docutils literal notranslate"><span class="pre">1</span></code>) to seek relative
to the current position, <code class="xref py py-attr docutils literal notranslate"><span class="pre">os.SEEK_END</span></code> (<code class="docutils literal notranslate"><span class="pre">2</span></code>) to
seek relative to the file’s end.</li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridOut.tell">
<code class="descname">tell</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridOut.tell" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the current position of this file.</p>
</dd></dl>

<dl class="attribute">
<dt id="gridfs.grid_file.GridOut.upload_date">
<code class="descname">upload_date</code><a class="headerlink" href="#gridfs.grid_file.GridOut.upload_date" title="Permalink to this definition">¶</a></dt>
<dd><p>Date that this file was first uploaded.</p>
<p>This attribute is read-only.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="gridfs.grid_file.GridOutCursor">
<em class="property">class </em><code class="descclassname">gridfs.grid_file.</code><code class="descname">GridOutCursor</code><span class="sig-paren">(</span><em>collection</em>, <em>filter=None</em>, <em>skip=0</em>, <em>limit=0</em>, <em>no_cursor_timeout=False</em>, <em>sort=None</em>, <em>batch_size=0</em>, <em>session=None</em><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridOutCursor" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new cursor, similar to the normal
<a class="reference internal" href="../pymongo/cursor.html#pymongo.cursor.Cursor" title="pymongo.cursor.Cursor"><code class="xref py py-class docutils literal notranslate"><span class="pre">Cursor</span></code></a>.</p>
<p>Should not be called directly by application developers - see
the <a class="reference internal" href="index.html#gridfs.GridFS" title="gridfs.GridFS"><code class="xref py py-class docutils literal notranslate"><span class="pre">GridFS</span></code></a> method <a class="reference internal" href="index.html#gridfs.GridFS.find" title="gridfs.GridFS.find"><code class="xref py py-meth docutils literal notranslate"><span class="pre">find()</span></code></a> instead.</p>
<div class="admonition seealso">
<p class="first admonition-title">See also</p>
<p class="admonition-title">The MongoDB documentation on</p>
<p class="last"><a class="reference external" href="http://dochub.mongodb.org/core/cursors" name="gridfs.grid_file.GridOutCursor"><em>cursors</em></a></p>
</div>
<dl class="method">
<dt id="gridfs.grid_file.GridOutCursor.add_option">
<code class="descname">add_option</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridOutCursor.add_option" title="Permalink to this definition">¶</a></dt>
<dd><p>Set arbitrary query flags using a bitmask.</p>
<p>To set the tailable flag:
cursor.add_option(2)</p>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridOutCursor.next">
<code class="descname">next</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridOutCursor.next" title="Permalink to this definition">¶</a></dt>
<dd><p>Get next GridOut object from cursor.</p>
</dd></dl>

<dl class="method">
<dt id="gridfs.grid_file.GridOutCursor.remove_option">
<code class="descname">remove_option</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#gridfs.grid_file.GridOutCursor.remove_option" title="Permalink to this definition">¶</a></dt>
<dd><p>Unset arbitrary query flags using a bitmask.</p>
<p>To unset the tailable flag:
cursor.remove_option(2)</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="errors.html"
                        title="previous chapter"><code class="docutils literal notranslate"><span class="pre">errors</span></code> – Exceptions raised by the <code class="docutils literal notranslate"><span class="pre">gridfs</span></code> package</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="../../tools.html"
                        title="next chapter">Tools</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="../../_sources/api/gridfs/grid_file.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="../../tools.html" title="Tools"
             >next</a> |</li>
        <li class="right" >
          <a href="errors.html" title="errors – Exceptions raised by the gridfs package"
             >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">gridfs</span></code> – Tools for working with GridFS</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>