Files
doc-fr/reference/mongo/functions/mongo-query.xml
T
Damien Seguy 328e3a7357 initial translation
git-svn-id: https://svn.php.net/repository/phpdoc/fr/trunk@276493 c90b9560-bf6c-de11-be94-00142212c4b1
2009-02-26 10:39:59 +00:00

182 lines
4.9 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.1 $ -->
<!-- EN-Revision: 1.4 Maintainer: dams Status: ready -->
<!-- Reviewed: no -->
<refentry xml:id="function.mongo-query" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>mongo_query</refname>
<refpurpose>Exécute une requête Mongo</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<type>resource</type><methodname>mongo_query</methodname>
<methodparam><type>resource</type><parameter>connection</parameter></methodparam>
<methodparam><type>string</type><parameter>ns</parameter></methodparam>
<methodparam><type>array</type><parameter>query</parameter></methodparam>
<methodparam><type>int</type><parameter>skip</parameter></methodparam>
<methodparam><type>int</type><parameter>limit</parameter></methodparam>
<methodparam><type>array</type><parameter>sort</parameter></methodparam>
<methodparam><type>array</type><parameter>fields</parameter></methodparam>
<methodparam><type>array</type><parameter>hint</parameter></methodparam>
</methodsynopsis>
<para>
<function>mongo_query</function> exécute une requête et retourne un
curseur de base de données, qui peut être passé aux fonctions
<function>mongo_has_next</function> ou <function>mongo_next</function>.
Il est fortement recommandé d'utiliser la fonction find()
de MongoCollection, qui est une interface avancée pour cette
fonction, et gère un très grand nombre de paramètres.
</para>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<para>
<variablelist>
<varlistentry>
<term><parameter>connection</parameter></term>
<listitem>
<para>
&mongo.connexion;
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>ns</parameter></term>
<listitem>
<para>
&mongo.collection.name;
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>query</parameter></term>
<listitem>
<para>
La requête à exécuter.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>skip</parameter></term>
<listitem>
<para>
Le nombre de documents à omettre.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>limit</parameter></term>
<listitem>
<para>
Le nombre maximal de documents à omettre.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>sort</parameter></term>
<listitem>
<para>
Un tableau de champs et de directions à utiliser.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>fields</parameter></term>
<listitem>
<para>
Un tableau de champs à retourner pour chaque document.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><parameter>hint</parameter></term>
<listitem>
<para>
Un tableau d'indications pour la base de données.
</para>
</listitem>
</varlistentry>
</variablelist>
</para>
</refsect1>
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
Retourne un curseur sur le résultat.
</para>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<para>
<example>
<title>Exemple avec <function>mongo_query</function></title>
<para>
Cet exemple montre comment utiliser une requête pour
obtenir une page de résultats de recherche dans la base
de données.
</para>
<programlisting role="php">
<![CDATA[
<?php
$searchterm = "pandas";
$pagenum = 2;
$resultsPerPage = 10;
$conn = mongo_connect("localhost", true);
if (!$conn) {
die("Impossible de se connecter à Mongo.");
}
$cursor = mongo_query($conn, "zoo.animals", array("name" => $searchterm), ($pagenum-1)*$resultsPerPage, $resultsPerPage, null, null, null);
?>
]]>
</programlisting>
<para>
Ce script retourne les objets de 11 à 20, dans la table
<literal>zoo.animals</literal>, avec le nom de champs <literal>"panda"</literal>.
</para>
</example>
</para>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<para>
<simplelist>
<member><function>mongo_has_next</function></member>
<member><function>mongo_next</function></member>
</simplelist>
</para>
</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:"../../../../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
-->