本文整理汇总了PHP中MongoClient::_getWriteProtocol方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoClient::_getWriteProtocol方法的具体用法?PHP MongoClient::_getWriteProtocol怎么用?PHP MongoClient::_getWriteProtocol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoClient
的用法示例。
在下文中一共展示了MongoClient::_getWriteProtocol方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: remove
/**
* Remove records from this collection
*
* @param array $criteria - Description of records to remove.
* @param array $options - Options for remove. "justOne" Remove at
* most one record matching this criteria.
*
* @return bool|array - Returns an array containing the status of the
* removal if the "w" option is set. Otherwise, returns TRUE. Fields
* in the status array are described in the documentation for
* MongoCollection::insert().
*/
public function remove(array $criteria = [], array $options = [])
{
$timeout = MongoCursor::$timeout;
if (!empty($options['timeout'])) {
$timeout = $options['timeout'];
}
return $this->client->_getWriteProtocol()->opDelete($this->fqn, $criteria, $options, $timeout);
}
示例2: command
/**
* Execute a database command
*
* @param array $command - The query to send.
* @param array $options - This parameter is an associative array of
* the form array("optionname" => boolean, ...).
*
* @return array - Returns database response.
*/
public function command(array $cmd, array $options = [])
{
$timeout = MongoCursor::$timeout;
if (!empty($options['timeout'])) {
$timeout = $options['timeout'];
}
$protocol = empty($options['protocol']) ? $this->client->_getWriteProtocol() : $options['protocol'];
$response = $protocol->opQuery("{$this->name}.\$cmd", $cmd, 0, -1, 0, $timeout);
return $response['result'][0];
}