PHP Класс Sokil\Mongo\Database

Показать файл Открыть проект Примеры использования класса

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

Метод Описание
__construct ( Client $client, MongoDB | string $database )
__get ( $name )
authenticate ( string $username, string $password )
clearCollectionPool ( )
createCappedCollection ( string $name, integer $maxElements, integer $size ) : Collection
createCollection ( string $name, array $options = null ) : Collection Create collection
disableCollectionPool ( )
disableProfiler ( )
enableCollectionPool ( )
executeCommand ( array $command, array $options = [] ) : array Execute Mongo command
executeJS ( $code, array $args = [] )
findProfilerRows ( ) : Cursor
getCache ( string $namespace ) : Cache Get cache
getClient ( ) : Client
getCollection ( string $name ) : Collection
getDocumentByReference ( array $ref, boolean $useDocumentPool = true ) : Document | null Get Document instance by it's reference
getGridFS ( string $name = 'fs' ) : GridFS Get instance of GridFS
getLastError ( )
getMongoDB ( ) : MongoDB
getName ( ) : string
getProfilerLevel ( )
getProfilerParams ( )
getProfilerSlowMs ( )
getQueue ( string $channel ) : Queue
getReadPreference ( )
getWriteConcern ( ) : mixed Get current write concern May be used only if mongo extension version >=1.5
isCollectionPoolEmpty ( )
isCollectionPoolEnabled ( )
logout ( )
map ( string | array $name, string | array | Definition | null $classDefinition = null ) : Client Map collection name to class
profileAllQueries ( $slowms = null )
profileSlowQueries ( $slowms = 100 )
readNearest ( array $tags = null )
readPrimaryOnly ( )
readPrimaryPreferred ( array $tags = null )
readSecondaryOnly ( array $tags = null )
readSecondaryPreferred ( array $tags = null )
resetMapping ( ) : Client Reset specified mapping
setMajorityWriteConcern ( integer $timeout = 10000 ) : Database Define majority write concern.
setUnacknowledgedWriteConcern ( integer $timeout = 10000 ) : Database Define unacknowledged write concern.
setWriteConcern ( string | integer $w, integer $timeout = 10000 ) : Database Define write concern.
stats ( )

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

Метод Описание
defineCollection ( string $name, Definition | array | string $definition ) : Database Define collection through array or Definition instance
getCollectionDefinition ( string $name, array $defaultDefinition = null ) : string | array Get class name mapped to collection

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

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

public __construct ( Client $client, MongoDB | string $database )
$client Client
$database MongoDB | string

__get() публичный метод

public __get ( $name )

authenticate() публичный метод

public authenticate ( string $username, string $password )
$username string
$password string

clearCollectionPool() публичный метод

public clearCollectionPool ( )

createCappedCollection() публичный метод

public createCappedCollection ( string $name, integer $maxElements, integer $size ) : Collection
$name string name of collection
$maxElements integer The maximum number of elements to store in the collection.
$size integer Size in bytes.
Результат Collection

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

Create collection
public createCollection ( string $name, array $options = null ) : Collection
$name string name of collection
$options array array of options
Результат Collection

disableCollectionPool() публичный метод

disableProfiler() публичный метод

public disableProfiler ( )

enableCollectionPool() публичный метод

executeCommand() публичный метод

Execute Mongo command
public executeCommand ( array $command, array $options = [] ) : array
$command array
$options array
Результат array

executeJS() публичный метод

public executeJS ( $code, array $args = [] )
$args array

findProfilerRows() публичный метод

public findProfilerRows ( ) : Cursor
Результат Cursor

getCache() публичный метод

Get cache
public getCache ( string $namespace ) : Cache
$namespace string
Результат Cache

getClient() публичный метод

public getClient ( ) : Client
Результат Client

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

public getCollection ( string $name ) : Collection
$name string name of collection
Результат Collection

getDocumentByReference() публичный метод

Get Document instance by it's reference
public getDocumentByReference ( array $ref, boolean $useDocumentPool = true ) : Document | null
$ref array reference to document
$useDocumentPool boolean try to get document from pool or fetch document from database
Результат Document | null

getGridFS() публичный метод

Get instance of GridFS
public getGridFS ( string $name = 'fs' ) : GridFS
$name string prefix of files and chunks collection
Результат GridFS

getLastError() публичный метод

public getLastError ( )

getMongoDB() публичный метод

public getMongoDB ( ) : MongoDB
Результат MongoDB

getName() публичный метод

public getName ( ) : string
Результат string get name of database

getProfilerLevel() публичный метод

public getProfilerLevel ( )

getProfilerParams() публичный метод

public getProfilerParams ( )

getProfilerSlowMs() публичный метод

public getProfilerSlowMs ( )

getQueue() публичный метод

public getQueue ( string $channel ) : Queue
$channel string name of channel
Результат Queue

getReadPreference() публичный метод

public getReadPreference ( )

getWriteConcern() публичный метод

Get current write concern May be used only if mongo extension version >=1.5
public getWriteConcern ( ) : mixed
Результат mixed

isCollectionPoolEmpty() публичный метод

isCollectionPoolEnabled() публичный метод

logout() публичный метод

public logout ( )

map() публичный метод

Map collection name to class
public map ( string | array $name, string | array | Definition | null $classDefinition = null ) : Client
$name string | array collection name or array like [collectionName => collectionClass, ...]
$classDefinition string | array | Sokil\Mongo\Collection\Definition | null if $name is string, then full class name or array with parameters, else omitted
Результат Client

profileAllQueries() публичный метод

public profileAllQueries ( $slowms = null )

profileSlowQueries() публичный метод

public profileSlowQueries ( $slowms = 100 )

readNearest() публичный метод

public readNearest ( array $tags = null )
$tags array

readPrimaryOnly() публичный метод

public readPrimaryOnly ( )

readPrimaryPreferred() публичный метод

public readPrimaryPreferred ( array $tags = null )
$tags array

readSecondaryOnly() публичный метод

public readSecondaryOnly ( array $tags = null )
$tags array

readSecondaryPreferred() публичный метод

public readSecondaryPreferred ( array $tags = null )
$tags array

resetMapping() публичный метод

Reset specified mapping
public resetMapping ( ) : Client
Результат Client

setMajorityWriteConcern() публичный метод

May be used only if mongo extension version >=1.5
public setMajorityWriteConcern ( integer $timeout = 10000 ) : Database
$timeout integer timeout in milliseconds
Результат Database

setUnacknowledgedWriteConcern() публичный метод

May be used only if mongo extension version >=1.5
public setUnacknowledgedWriteConcern ( integer $timeout = 10000 ) : Database
$timeout integer timeout in milliseconds
Результат Database

setWriteConcern() публичный метод

May be used only if mongo extension version >=1.5
public setWriteConcern ( string | integer $w, integer $timeout = 10000 ) : Database
$w string | integer write concern
$timeout integer timeout in milliseconds
Результат Database

stats() публичный метод

public stats ( )