find() 공개 메소드

In order to perform "find" queries use Query class.
또한 보기: Query
public find ( array $condition = [], array $fields = [], array $options = [] ) : MongoDB\Driver\Cursor
$condition array query condition
$fields array fields to be selected
$options array query options (available since 2.1).
리턴 MongoDB\Driver\Cursor cursor for the search results
예제 #1
0
 /**
  * @inheritdoc
  * @return Cursor cursor for the search results
  */
 public function find($condition = [], $fields = [], $options = [])
 {
     return new Cursor($this, parent::find($condition, $fields, $options));
 }
예제 #2
0
 /**
  * Finds all records in collection.
  * @param  \yii\mongodb\Collection $collection
  * @param  array                   $condition
  * @param  array                   $fields
  * @return array                   rows
  */
 protected function findAll($collection, $condition = [], $fields = [])
 {
     $cursor = $collection->find($condition, $fields);
     $result = [];
     foreach ($cursor as $data) {
         $result[] = $data;
     }
     return $result;
 }