svn: /phpdoc/en/trunk/reference/mongo/mongocursor/ sort.xml

From: Date: Thu, 29 Dec 2011 14:51:09 +0000
Subject: svn: /phpdoc/en/trunk/reference/mongo/mongocursor/ sort.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-9301@lists.php.net to get a copy of this message
derick Thu, 29 Dec 2011 14:51:09 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=321508 Log: Explain the fields array better. Changed paths: U phpdoc/en/trunk/reference/mongo/mongocursor/sort.xml Modified: phpdoc/en/trunk/reference/mongo/mongocursor/sort.xml =================================================================== --- phpdoc/en/trunk/reference/mongo/mongocursor/sort.xml 2011-12-29 13:59:27 UTC (rev 321507) +++ phpdoc/en/trunk/reference/mongo/mongocursor/sort.xml 2011-12-29 14:51:09 UTC (rev 321508) @@ -25,8 +25,16 @@ </term> <listitem> <para> - The fields by which to sort. + An array of fields by which to sort. Each element in the array has as + key the field name, and as value either <literal>1</literal> for + ascending sort, or <literal>-1</literal> for descending sort. </para> + <para> + Each result is first sorted on the first field in the array, then (if + it exists) on the second field in the array, etc. This means that the + order of the fields in the <parameter>fields</parameter> array is + important. See also the examples section. + </para> </listitem> </varlistentry> </variablelist> @@ -36,7 +44,7 @@ <refsect1 role="returnvalues"> &reftitle.returnvalues; <para> - Returns this cursor. + Returns the same cursor that this method was called on. </para> </refsect1> @@ -47,32 +55,6 @@ </para> </refsect1> - <refsect1 role="changelog"> - &reftitle.changelog; - <para> - <informaltable> - <tgroup cols="2"> - <thead> - <row> - <entry>&Version;</entry> - <entry>&Description;</entry> - </row> - </thead> - <tbody> - <row> - <entry>1.3.0</entry> - <entry> - The <parameter>options</parameter> parameter does no longer accept - just a boolean to signify a safe insert. Instead, this now has to be done - with <literal>array('safe' => true)</literal>. - </entry> - </row> - </tbody> - </tgroup> - </informaltable> - </para> - </refsect1> - <refsect1 role="examples"> &reftitle.examples; <example> @@ -80,16 +62,16 @@ <programlisting role="php"> <![CDATA[ <?php -// sort x ascending +// Sort on field x, ascending $cursor->sort(array('x' => 1)); -// the associative array is ordered, for instance, these two -// examples might yield different results: +// The order in the associative array is important. For instance, these two +// examples will yield different results: -// sort date ascending and age descending +// Sort on date ascending and age descending $cursor->sort(array('date' => 1, 'age' => -1)); -// sort age descending and date ascending +// Sort on age descending and date ascending $cursor->sort(array('age' => -1, 'date' => 1)); ?> ]]>

« previous php.doc.cvs (#9301) next »