PHP Class Sokil\Mongo\Database

Afficher le fichier Open project: sokil/php-mongo Class Usage Examples

Méthodes publiques

Méthode Description
__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 ( )

Private Methods

Méthode Description
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

Method Details

__construct() public méthode

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

__get() public méthode

public __get ( $name )

authenticate() public méthode

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

clearCollectionPool() public méthode

public clearCollectionPool ( )

createCappedCollection() public méthode

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.
Résultat Collection

createCollection() public méthode

Create collection
public createCollection ( string $name, array $options = null ) : Collection
$name string name of collection
$options array array of options
Résultat Collection

disableCollectionPool() public méthode

disableProfiler() public méthode

public disableProfiler ( )

enableCollectionPool() public méthode

executeCommand() public méthode

Execute Mongo command
public executeCommand ( array $command, array $options = [] ) : array
$command array
$options array
Résultat array

executeJS() public méthode

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

findProfilerRows() public méthode

public findProfilerRows ( ) : Cursor
Résultat Cursor

getCache() public méthode

Get cache
public getCache ( string $namespace ) : Cache
$namespace string
Résultat Cache

getClient() public méthode

public getClient ( ) : Client
Résultat Client

getCollection() public méthode

public getCollection ( string $name ) : Collection
$name string name of collection
Résultat Collection

getDocumentByReference() public méthode

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
Résultat Document | null

getGridFS() public méthode

Get instance of GridFS
public getGridFS ( string $name = 'fs' ) : GridFS
$name string prefix of files and chunks collection
Résultat GridFS

getLastError() public méthode

public getLastError ( )

getMongoDB() public méthode

public getMongoDB ( ) : MongoDB
Résultat MongoDB

getName() public méthode

public getName ( ) : string
Résultat string get name of database

getProfilerLevel() public méthode

public getProfilerLevel ( )

getProfilerParams() public méthode

public getProfilerParams ( )

getProfilerSlowMs() public méthode

public getProfilerSlowMs ( )

getQueue() public méthode

public getQueue ( string $channel ) : Queue
$channel string name of channel
Résultat Queue

getReadPreference() public méthode

public getReadPreference ( )

getWriteConcern() public méthode

Get current write concern May be used only if mongo extension version >=1.5
public getWriteConcern ( ) : mixed
Résultat mixed

isCollectionPoolEmpty() public méthode

isCollectionPoolEnabled() public méthode

logout() public méthode

public logout ( )

map() public méthode

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
Résultat Client

profileAllQueries() public méthode

public profileAllQueries ( $slowms = null )

profileSlowQueries() public méthode

public profileSlowQueries ( $slowms = 100 )

readNearest() public méthode

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

readPrimaryOnly() public méthode

public readPrimaryOnly ( )

readPrimaryPreferred() public méthode

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

readSecondaryOnly() public méthode

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

readSecondaryPreferred() public méthode

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

resetMapping() public méthode

Reset specified mapping
public resetMapping ( ) : Client
Résultat Client

setMajorityWriteConcern() public méthode

May be used only if mongo extension version >=1.5
public setMajorityWriteConcern ( integer $timeout = 10000 ) : Database
$timeout integer timeout in milliseconds
Résultat Database

setUnacknowledgedWriteConcern() public méthode

May be used only if mongo extension version >=1.5
public setUnacknowledgedWriteConcern ( integer $timeout = 10000 ) : Database
$timeout integer timeout in milliseconds
Résultat Database

setWriteConcern() public méthode

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
Résultat Database

stats() public méthode

public stats ( )