PHP Класс yii\mongodb\Database

С версии: 2.0
Автор: Paul Klimov ([email protected])
Наследование: extends yii\base\Object
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$connection MongoDB connection.
$name name of this database.

Открытые методы

Метод Описание
clearCollections ( ) Clears internal collection lists.
createCollection ( string $name, array $options = [] ) : boolean Creates new collection.
createCommand ( array $document = [] ) : Command Creates MongoDB command associated with this database.
dropCollection ( string $name ) : boolean Drops specified collection.
getCollection ( string $name, boolean $refresh = false ) : Collection Returns the Mongo collection with the given name.
getFileCollection ( string $prefix = 'fs', boolean $refresh = false ) : Collection Returns Mongo GridFS collection with given prefix.
listCollections ( array $condition = [], array $options = [] ) : array Returns the list of available collections in this database.

Защищенные методы

Метод Описание
selectCollection ( string $name ) : Collection Selects collection with given name.
selectFileCollection ( string $prefix ) : Collection Selects GridFS collection with given prefix.

Описание методов

clearCollections() публичный Метод

This method can be used to break cycle references between Database and Collection instances.
public clearCollections ( )

createCollection() публичный Метод

Note: Mongo creates new collections automatically on the first demand, this method makes sense only for the migration script or for the case you need to create collection with the specific options.
public createCollection ( string $name, array $options = [] ) : boolean
$name string name of the collection
$options array collection options in format: "name" => "value"
Результат boolean whether operation was successful.

createCommand() публичный Метод

Creates MongoDB command associated with this database.
С версии: 2.1
public createCommand ( array $document = [] ) : Command
$document array command document contents.
Результат Command command instance.

dropCollection() публичный Метод

Drops specified collection.
С версии: 2.1
public dropCollection ( string $name ) : boolean
$name string name of the collection
Результат boolean whether operation was successful.

getCollection() публичный Метод

Returns the Mongo collection with the given name.
public getCollection ( string $name, boolean $refresh = false ) : Collection
$name string collection name
$refresh boolean whether to reload the collection instance even if it is found in the cache.
Результат Collection Mongo collection instance.

getFileCollection() публичный Метод

Returns Mongo GridFS collection with given prefix.
public getFileCollection ( string $prefix = 'fs', boolean $refresh = false ) : Collection
$prefix string collection prefix.
$refresh boolean whether to reload the collection instance even if it is found in the cache.
Результат yii\mongodb\file\Collection Mongo GridFS collection.

listCollections() публичный Метод

Returns the list of available collections in this database.
С версии: 2.1.1
public listCollections ( array $condition = [], array $options = [] ) : array
$condition array filter condition.
$options array options list.
Результат array collections information.

selectCollection() защищенный Метод

Selects collection with given name.
protected selectCollection ( string $name ) : Collection
$name string collection name.
Результат Collection collection instance.

selectFileCollection() защищенный Метод

Selects GridFS collection with given prefix.
protected selectFileCollection ( string $prefix ) : Collection
$prefix string file collection prefix.
Результат yii\mongodb\file\Collection file collection instance.

Описание свойств

$connection публичное свойство

MongoDB connection.
public $connection

$name публичное свойство

name of this database.
public $name