MongoCollection::ensureIndex
MongoCollection::findOne
MongoCollection
PHP Manual

# MongoCollection::find

(PECL mongo >=0.9.0)

MongoCollection::find — Querys this collection

### 설명

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

### 인수

`query`

  The fields for which to search.

`fields`

  Fields of the results to return.

### 반환값

Returns a cursor for the search results.

### 예제

Example #1 MongoCollection::find() example

This example demonstrates how to search for a range.

`<?php
// search for documents where 5 < x < 20
$rangeQuery = array('x' => array( '$gt' => 5, '$lt' => 20 ));
$cursor = $collection->find($rangeQuery);
?>`

MongoCollection::ensureIndex
MongoCollection::findOne
MongoCollection
PHP Manual