PHP Класс Webiny\Component\Mongo\Mongo

Наследование: use trait Webiny\Component\StdLib\ComponentTrait, use trait Webiny\Component\StdLib\StdLibTrait
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( $uri, array $uriOptions = [], array $driverOptions = [], $collectionPrefix = '' )
aggregate ( $collectionName, array $pipeline, array $options = [] )
bulkWrite ( $collectionName, array $operations, array $options = [] )
command ( $command, array $options = [] )
count ( $collectionName, $filter = [], array $options = [] )
createCollection ( string $name, array $options = [] ) : array | object Create collection
createIndex ( $collectionName, Webiny\Component\Mongo\Index\IndexInterface $index, array $options = [] )
createIndexes ( $collectionName, array $indexes )
delete ( $collectionName, $filter, array $options = [] )
distinct ( $collectionName, $fieldName, $filter = [], array $options = [] )
dropCollection ( string $collectionName, array $options = [] ) : array | object Drop collection
dropIndex ( $collectionName, $indexName, array $options = [] )
dropIndexes ( $collectionName, array $options = [] )
find ( $collectionName, $filter = [], $sort = [], $limit, $skip, array $options = [] )
findOne ( $collectionName, $filter = [], array $options = [] )
findOneAndDelete ( $collectionName, $filter, array $options = [] )
findOneAndReplace ( $collectionName, $filter, $replacement, array $options = [] )
findOneAndUpdate ( $collectionName, $filter, $update, array $options = [] )
getCollectionPrefix ( ) : string Get collection prefix
getNamespace ( $collectionName )
id ( null | string $id = null ) : MongoDB\BSON\ObjectID Construct Mongo ID
insertMany ( $collectionName, array $documents, array $options = [] )
insertOne ( $collectionName, $document, array $options = [] )
isId ( $id ) : boolean Check if given string is a valid MongoId string
listCollections ( array $options = [] ) : mixed List collections
listIndexes ( string $collectionName, array $options = [] ) : array
selectDatabase ( string $database ) Select database
update ( $collectionName, $filter, $update, array $options = [] )

Приватные методы

Метод Описание
cName ( $collectionName ) : string Get collection name

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

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

public __construct ( $uri, array $uriOptions = [], array $driverOptions = [], $collectionPrefix = '' )
$uriOptions array
$driverOptions array

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

public aggregate ( $collectionName, array $pipeline, array $options = [] )
$pipeline array
$options array

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

public bulkWrite ( $collectionName, array $operations, array $options = [] )
$operations array
$options array

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

public command ( $command, array $options = [] )
$options array

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

public count ( $collectionName, $filter = [], array $options = [] )
$options array

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

Create collection
public createCollection ( string $name, array $options = [] ) : array | object
$name string Name
$options array
Результат array | object

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

public createIndex ( $collectionName, Webiny\Component\Mongo\Index\IndexInterface $index, array $options = [] )
$index Webiny\Component\Mongo\Index\IndexInterface
$options array

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

public createIndexes ( $collectionName, array $indexes )
$indexes array

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

public delete ( $collectionName, $filter, array $options = [] )
$options array

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

public distinct ( $collectionName, $fieldName, $filter = [], array $options = [] )
$options array

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

Drop collection
public dropCollection ( string $collectionName, array $options = [] ) : array | object
$collectionName string
$options array
Результат array | object

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

public dropIndex ( $collectionName, $indexName, array $options = [] )
$options array

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

public dropIndexes ( $collectionName, array $options = [] )
$options array

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

public find ( $collectionName, $filter = [], $sort = [], $limit, $skip, array $options = [] )
$options array

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

public findOne ( $collectionName, $filter = [], array $options = [] )
$options array

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

public findOneAndDelete ( $collectionName, $filter, array $options = [] )
$options array

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

public findOneAndReplace ( $collectionName, $filter, $replacement, array $options = [] )
$options array

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

public findOneAndUpdate ( $collectionName, $filter, $update, array $options = [] )
$options array

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

Get collection prefix
public getCollectionPrefix ( ) : string
Результат string

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

public getNamespace ( $collectionName )

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

Construct Mongo ID
public id ( null | string $id = null ) : MongoDB\BSON\ObjectID
$id null | string (Optional)
Результат MongoDB\BSON\ObjectID

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

public insertMany ( $collectionName, array $documents, array $options = [] )
$documents array
$options array

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

public insertOne ( $collectionName, $document, array $options = [] )
$options array

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

Check if given string is a valid MongoId string
public isId ( $id ) : boolean
$id
Результат boolean

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

List collections
public listCollections ( array $options = [] ) : mixed
$options array
Результат mixed

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

public listIndexes ( string $collectionName, array $options = [] ) : array
$collectionName string
$options array
Результат array

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

Select database
public selectDatabase ( string $database )
$database string

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

public update ( $collectionName, $filter, $update, array $options = [] )
$options array