本文整理匯總了PHP中Mongo::getIndexInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP Mongo::getIndexInfo方法的具體用法?PHP Mongo::getIndexInfo怎麽用?PHP Mongo::getIndexInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mongo
的用法示例。
在下文中一共展示了Mongo::getIndexInfo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testGetIndexInfo
public function testGetIndexInfo()
{
$info = $this->object->getIndexInfo();
$this->assertEquals(count($info), 0);
$this->object->ensureIndex((object) array('foo' => 1));
$this->object->ensureIndex((object) array('foo' => -1));
$this->object->ensureIndex((object) array('bar' => 1, 'baz' => -1));
$info = $this->object->getIndexInfo();
$this->assertEquals(4, count($info), json_encode($info));
$this->assertEquals($info[1]['key']['foo'], 1);
$this->assertEquals($info[1]['name'], 'foo_1');
$this->assertEquals($info[2]['key']['foo'], -1);
$this->assertEquals($info[2]['name'], 'foo_-1');
$this->assertEquals($info[3]['key']['bar'], 1);
$this->assertEquals($info[3]['key']['baz'], -1);
$this->assertEquals($info[3]['name'], 'bar_1_baz_-1');
}