本文整理汇总了PHP中MongoDB\Driver\Server::executeQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP Server::executeQuery方法的具体用法?PHP Server::executeQuery怎么用?PHP Server::executeQuery使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoDB\Driver\Server
的用法示例。
在下文中一共展示了Server::executeQuery方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeLegacy
/**
* Returns information for all indexes for this collection by querying the
* "system.indexes" collection (MongoDB <3.0).
*
* @param Server $server
* @return IndexInfoIteratorIterator
*/
private function executeLegacy(Server $server)
{
$filter = array('ns' => $this->databaseName . '.' . $this->collectionName);
$options = isset($this->options['maxTimeMS']) ? array('modifiers' => array('$maxTimeMS' => $this->options['maxTimeMS'])) : array();
$cursor = $server->executeQuery($this->databaseName . '.system.indexes', new Query($filter, $options));
$cursor->setTypeMap(array('root' => 'array', 'document' => 'array'));
return new IndexInfoIteratorIterator($cursor);
}
示例2: executeLegacy
/**
* Returns information for all collections in this database by querying the
* "system.namespaces" collection (MongoDB <3.0).
*
* @param Server $server
*
* @return CollectionInfoLegacyIterator
* @throws InvalidArgumentException if filter.name is not a string.
*/
private function executeLegacy(Server $server)
{
$filter = empty($this->options['filter']) ? [] : (array) $this->options['filter'];
if (array_key_exists('name', $filter)) {
if (!is_string($filter['name'])) {
throw InvalidArgumentException::invalidType('filter name for MongoDB <3.0', $filter['name'], 'string');
}
$filter['name'] = $this->databaseName . '.' . $filter['name'];
}
$options = isset($this->options['maxTimeMS']) ? ['modifiers' => ['$maxTimeMS' => $this->options['maxTimeMS']]] : [];
$cursor = $server->executeQuery($this->databaseName . '.system.namespaces', new Query($filter, $options));
$cursor->setTypeMap(['root' => 'array', 'document' => 'array']);
return new CollectionInfoLegacyIterator($cursor);
}
示例3: execute
/**
* Execute the operation.
*
* @see Executable::execute()
* @param Server $server
* @return Cursor
*/
public function execute(Server $server)
{
$readPreference = isset($this->options['readPreference']) ? $this->options['readPreference'] : null;
return $server->executeQuery($this->databaseName . '.' . $this->collectionName, $this->createQuery(), $readPreference);
}
示例4: execute
/**
* Execute the operation.
*
* @see Executable::execute()
* @param Server $server
* @return Cursor
*/
public function execute(Server $server)
{
$readPreference = isset($this->options['readPreference']) ? $this->options['readPreference'] : null;
$cursor = $server->executeQuery($this->databaseName . '.' . $this->collectionName, $this->createQuery(), $readPreference);
if (isset($this->options['typeMap'])) {
$cursor->setTypeMap($this->options['typeMap']);
}
return $cursor;
}
示例5: execute
/**
* Execute the operation.
*
* @see Executable::execute()
* @param Server $server
* @return Cursor
*/
public function execute(Server $server)
{
return $server->executeQuery($this->databaseName . '.' . $this->collectionName, $this->createQuery());
}