downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

MongoCollection::__toString> <MongoCollection::setSlaveOkay
[edit] Last updated: Fri, 25 May 2012

view this page in

MongoCollection::toIndexString

(バージョン情報なし。おそらく SVN 版にしか存在しないでしょう)

MongoCollection::toIndexStringインデックスを指定するキーを、インデックスを指す文字列に変換する

説明

static protected string MongoCollection::toIndexString ( mixed $keys )

パラメータ

keys

指し示す文字列に変換したいフィールド。

返り値

インデックスを表す文字列を返します。

例1 MongoCollection::toIndexString() の例

この例は、キーからインデックス名を作成する方法を示します。 このメソッドは protected (static) メソッドなので、まずは子クラスでオーバーロードしなければなりません。

<?php
// 派生クラスを作ってメソッドを "public" にします
class MyCollection extends MongoCollection
{
    static public function 
toIndexString($a)
    {
        return 
parent::toIndexString($a);
    }
}

echo 
MyCollection::toIndexString("foo")), "\n";
// 出力: foo_1

echo MyCollection::toIndexString(array('name' => 1'age' => -1)), "\n";
// 出力: name_1_age_-1
?>

参考

MongoDB コアドキュメントの » indexes



add a note add a note User Contributed Notes MongoCollection::toIndexString
There are no user contributed notes for this page.

 
show source | credits | stats | sitemap | contact | advertising | mirror sites