PHP Portal » PHP Handbuch » MongoCollection::find

Werbung

MongoCollection::find


(PECL mongo >=0.9.0)

MongoCollection::findQuerys this collection

Beschreibung

public MongoCursor MongoCollection::find ([ array $query = array() [, array $fields = array() ]] )

Parameter-Liste

query

The fields for which to search.

fields

Fields of the results to return.

Rückgabewerte

Returns a cursor for the search results.

Beispiele

Beispiel #1 MongoCollection::find() example

This example demonstrates how to search for a range.

PHP Code
1
2
3
4
// search for documents where 5 < x < 20 $rangeQuery = array('x' => array( '$gt' => 5, '$lt' => 20 )); $cursor = $collection->find($rangeQuery);