From 8ad788358deb7287043bea8eddc424ec72ea9c6e Mon Sep 17 00:00:00 2001 From: Derick Rethans Date: Thu, 29 Dec 2011 15:45:00 +0000 Subject: [PATCH] Explain fields for querying and return a bit better. Also add a warning for the "$" issue and add the difference between find() and findOne(). git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@321515 c90b9560-bf6c-de11-be94-00142212c4b1 --- reference/mongo/mongocollection/findone.xml | 22 +++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/reference/mongo/mongocollection/findone.xml b/reference/mongo/mongocollection/findone.xml index 7e9a88d125..739d93a561 100644 --- a/reference/mongo/mongocollection/findone.xml +++ b/reference/mongo/mongocollection/findone.xml @@ -14,6 +14,11 @@ arrayqueryarray() arrayfieldsarray() + + As opposed to MongoCollection::find, this method + will return only the first result from the result set, + and not a MongoCursor that can be iterated over. + @@ -26,8 +31,19 @@ - The fields for which to search. + The fields for which to search. MongoDB's query language is quite + extensive. The PHP driver will in almost all cases pass the query + straight through to the server, so reading the MongoDB core docs on + find is a good idea. + + + Please make sure that for all special query operaters (starting with + $) you use single quotes so that PHP doesn't try to + replace "$exists" with the value of the variable + $exists. + + @@ -36,7 +52,9 @@ - Fields of the results to return. + Fields of the results to return. The array is in the format + array('fieldname' => true, 'fieldname2' => true). + The _id field is always returned.