本文整理汇总了PHP中MongoCollection::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoCollection::getName方法的具体用法?PHP MongoCollection::getName怎么用?PHP MongoCollection::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoCollection
的用法示例。
在下文中一共展示了MongoCollection::getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pop
/**
* @see QueueInterface::pop()
*/
public function pop()
{
$command = array('findandmodify' => $this->collection->getName(), 'remove' => 1, 'fields' => array('task' => 1), 'query' => array('eta' => array('$lte' => new \MongoDate())), 'sort' => array('eta' => 1));
$result = $this->collection->db->command($command);
if (!$result['ok']) {
throw new \RuntimeException($result['errmsg']);
}
$data = $result['value'];
return $data ? $this->serializer->unserialize($data['task']) : false;
}
示例2: create
/**
* Indicate that the table needs to be created.
*
* @return bool
*/
public function create()
{
$collection = $this->collection->getName();
$db = $this->connection->getMongoDB();
// Ensure the collection is created.
$db->createCollection($collection);
}
示例3: generateId
public function generateId(MongoCollection $collection)
{
$collection_name = $collection->getName();
$document = $this->collection->findAndModify(array('_id' => $collection_name), array('$inc' => array('_max_id' => 1)), null, array('new' => true));
if (!$document) {
$this->collection->insert(array('_id' => $collection_name, '_max_id' => $this->autoIncrement));
return $this->generateId($collection);
}
return $document['_max_id'];
}
示例4: doMapReduce
protected function doMapReduce($map, $reduce, array $query, array $options)
{
if (is_string($map)) {
$map = new \MongoCode($map);
}
if (is_string($reduce)) {
$reduce = new \MongoCode($reduce);
}
$command = array();
$command['mapreduce'] = $this->mongoCollection->getName();
$command['map'] = $map;
$command['reduce'] = $reduce;
$command['query'] = $query;
$command = array_merge($command, $options);
$result = $this->database->command($command);
if (!$result['ok']) {
throw new \RuntimeException($result['errmsg']);
}
return $this->database->selectCollection($result['result'])->find();
}
示例5: doNear
/**
* Execute the geoNear command.
*
* @see Collection::near()
* @param array|Point $near
* @param array $query
* @param array $options
* @return ArrayIterator
* @throws ResultException if the command fails
*/
protected function doNear($near, array $query, array $options)
{
$options = isset($options['timeout']) ? $this->convertSocketTimeout($options) : $options;
if ($near instanceof Point) {
$near = $near->jsonSerialize();
}
$command = array();
$command['geoNear'] = $this->mongoCollection->getName();
$command['near'] = $near;
$command['spherical'] = isset($near['type']);
$command['query'] = (object) $query;
$command = array_merge($command, $options);
$database = $this->database;
$result = $this->retry(function () use($database, $command) {
return $database->command($command);
});
if (empty($result['ok'])) {
throw new ResultException($result);
}
$arrayIterator = new ArrayIterator(isset($result['results']) ? $result['results'] : array());
$arrayIterator->setCommandResult($result);
return $arrayIterator;
}
示例6: generateCacheKey
/**
* Generate the unique cache key for the current query.
*
* @return string
*/
public function generateCacheKey()
{
$key = array('connection' => $this->connection->getName(), 'collection' => $this->collection->getName(), 'wheres' => $this->wheres, 'columns' => $this->columns, 'groups' => $this->groups, 'orders' => $this->orders, 'offset' => $this->offset, 'aggregate' => $this->aggregate);
return md5(serialize(array_values($key)));
}
示例7: testGetName
public function testGetName()
{
$this->assertEquals($this->object->getName(), 'c');
}
示例8: dumpCollection
/**
* Dumps all objects in a collection
*
* @param \MongoCollection $collection collection
* @param string $destinationDir destination dir
*
* @return void
*/
private function dumpCollection(\MongoCollection $collection, $destinationDir)
{
foreach ($collection->find() as $record) {
$this->dumpObject($record, $collection->getName(), $destinationDir);
}
}
示例9: getName
/**
* Get name of collection
*
* @return string name of collection
*/
public function getName()
{
return $this->_mongoCollection->getName();
}