MongoCursor クラス
導入
データベースクエリの結果を表すオブジェクトです。
データベースへの実際の問い合わせは、next() あるいは hasNext() がコールされるまで行われません。問い合わせが行われる前に、 コマンドを次のように連ねることができます。
<?php
$cursor = $collection->find()->limit(10);
// まだデータベースへの問い合わせは行われていないので、検索オプションをさらに追加することができます
$cursor = $cursor->sort(array("a" => 1));
var_dump($cursor->getNext());
// ここでデータベースへの問い合わせが行われるので、これ以降はオプションを追加することはできません
// つまり、これは例外をスローします
$cursor->skip(4);
?>
クラス概要
MongoCursor
implements
Iterator
{
/* 静的フィールド */
static
boolean
$slaveOkay
= FALSE
;
/* メソッド */
__construct
( resource $connection
, string $ns
[, array $query = array()
[, array $fields = array()
]] )
}目次
- MongoCursor::__construct — 新しいカーソルを作成する
- MongoCursor::count — このクエリの結果の数を数える
- MongoCursor::current — 現在の結果を返す
- MongoCursor::dead — Checks if there are documents that have not been sent yet from the database for this cursor
- MongoCursor::doQuery — クエリを実行する
- MongoCursor::explain — 最適化やデバッグの際に有効な、クエリの explain を返す
- MongoCursor::getNext — このカーソルがさす次のオブジェクトを返し、カーソルを進める
- MongoCursor::hasNext — このカーソルにまだ要素があるかどうかを調べる
- MongoCursor::hint — クエリについてのヒントをデータベースに与える
- MongoCursor::key — 現在の結果の _id を返す
- MongoCursor::limit — 返す結果の数を制限する
- MongoCursor::next — カーソルを次の結果に進める
- MongoCursor::reset — カーソルを消去する
- MongoCursor::rewind — カーソルを結果セットの先頭に戻す
- MongoCursor::skip — 結果をスキップする
- MongoCursor::slaveOkay — Sets whether this query can be done on a slave
- MongoCursor::snapshot — Use snapshot mode for the query
- MongoCursor::sort — 指定したフィールドで結果をソートする
- MongoCursor::tailable — Sets whether this cursor will be left open after fetching the last results
- MongoCursor::valid — カーソルが正しい結果を読んでいるかどうかを調べる
MongoCursor
There are no user contributed notes for this page.
