<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->

<refentry xml:id="mongodb-driver-manager.executereadcommand" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>MongoDB\Driver\Manager::executeReadCommand</refname>
  <refpurpose>Execute a database command that reads</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <modifier>final</modifier> <modifier>public</modifier> <type>MongoDB\Driver\Cursor</type><methodname>MongoDB\Driver\Manager::executeReadCommand</methodname>
   <methodparam><type>string</type><parameter>db</parameter></methodparam>
   <methodparam><type>MongoDB\Driver\Command</type><parameter>command</parameter></methodparam>
   <methodparam choice="opt"><type class="union"><type>array</type><type>null</type></type><parameter>options</parameter><initializer>&null;</initializer></methodparam>
  </methodsynopsis>
  <para>
   Selects a server according to the <literal>"readPreference"</literal> option
   and executes the command on that server. By default, the read preference from
   the <link linkend="mongodb-driver-manager.construct-uri">MongoDB Connection
   URI</link> will be used.
  </para>
  <para>
   This method will apply logic that is specific to commands that read (e.g.
   <link xlink:href="&url.mongodb.docs;reference/command/count/">count</link>)
   and take the MongoDB server version into account. The
   <literal>"readConcern"</literal> option will default to the corresponding
   value from the <link linkend="mongodb-driver-manager.construct-uri">MongoDB
   Connection URI</link>.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <variablelist>
   &mongodb.parameter.db;
   &mongodb.parameter.command;
   <varlistentry>
    <term><parameter>options</parameter></term>
    <listitem>
     <para>
      <table>
       <title>options</title>
       <tgroup cols="3">
        <thead>
         <row>
          <entry>Option</entry>
          <entry>Type</entry>
          <entry>Description</entry>
         </row>
        </thead>
        <tbody>
         &mongodb.option.readConcern;
         &mongodb.option.readPreference;
         &mongodb.option.session;
        </tbody>
       </tgroup>
      </table>
     </para>
     &mongodb.option.transactionReadWriteConcern;
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  &mongodb.returns.cursor;
 </refsect1>

 <refsect1 role="errors">
  &reftitle.errors;
  <simplelist>
   &mongodb.throws.session-readwriteconcern;
   &mongodb.throws.std;
   <member>Throws <classname>MongoDB\Driver\Exception\RuntimeException</classname> on other errors (e.g. invalid command).</member>
  </simplelist>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <simplelist>
   <member><classname>MongoDB\Driver\Command</classname></member>
   <member><classname>MongoDB\Driver\Cursor</classname></member>
   <member><function>MongoDB\Driver\Manager::executeCommand</function></member>
   <member><function>MongoDB\Driver\Manager::executeReadWriteCommand</function></member>
   <member><function>MongoDB\Driver\Manager::executeWriteCommand</function></member>
   <member><function>MongoDB\Driver\Server::executeReadCommand</function></member>
  </simplelist>
 </refsect1>

</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->
