PHP 클래스 Sokil\Mongo\Client

파일 보기 프로젝트 열기: sokil/php-mongo 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( string $dsn = null, array $options = null )
__get ( $name )
createPersistence ( ) : Sokil\Mongo\Persistence Create new persistence manager
debug ( $enabled = true ) Enable or disable debug mode
getCollection ( string $name ) : Collection Get collection from previously selected database by self::useDatabase()
getConnectOptions ( )
getConnections ( ) : array Get list of all active connections through this client
getCurrentDatabaseName ( ) : string Get name of current database
getDatabase ( string $name = null ) : Database Get database instance
getDbVersion ( ) : string
getDsn ( )
getLogger ( ) : Psr\Log\LoggerInterface
getMongoClient ( ) : MongoClient Get mongo connection instance
getReadPreference ( )
getVersion ( ) : string
getWriteConcern ( ) : string | integer Get currently active write concern on connection level
hasLogger ( ) : boolean Check if logger defined
isDebugEnabled ( ) Check state of debug mode
map ( array $mapping ) : Client Map database and collection name to class.
readNearest ( array $tags = null )
readPrimaryOnly ( )
readPrimaryPreferred ( array $tags = null )
readSecondaryOnly ( array $tags = null )
readSecondaryPreferred ( array $tags = null )
removeLogger ( ) : Client Remove logger
setConnectOptions ( array $options ) : Client Set connect options
setCredentials ( type $username, type $password ) : Client Set credentials to auth on db, specified in connect options or dsn.
setDsn ( $dsn )
setLogger ( Psr\Log\LoggerInterface $logger )
setMajorityWriteConcern ( integer $timeout = 10000 ) : Client Define majority write concern on whole requests
setMongoClient ( MongoClient $client ) : Client Set mongo's client
setUnacknowledgedWriteConcern ( integer $timeout = 10000 ) : Client Define unacknowledged write concern on whole requests
setWriteConcern ( string | integer $w, integer $timeout = 10000 ) : Client Define write concern on whole requests
useDatabase ( string $name ) : Client Select database

메소드 상세

__construct() 공개 메소드

public __construct ( string $dsn = null, array $options = null )
$dsn string Data Source Name
$options array

__get() 공개 메소드

public __get ( $name )

createPersistence() 공개 메소드

Create new persistence manager
public createPersistence ( ) : Sokil\Mongo\Persistence
리턴 Sokil\Mongo\Persistence

debug() 공개 메소드

Enable or disable debug mode
public debug ( $enabled = true )

getCollection() 공개 메소드

Get collection from previously selected database by self::useDatabase()
public getCollection ( string $name ) : Collection
$name string
리턴 Collection

getConnectOptions() 공개 메소드

public getConnectOptions ( )

getConnections() 공개 메소드

Get list of all active connections through this client
public getConnections ( ) : array
리턴 array

getCurrentDatabaseName() 공개 메소드

Get name of current database
public getCurrentDatabaseName ( ) : string
리턴 string

getDatabase() 공개 메소드

Get database instance
public getDatabase ( string $name = null ) : Database
$name string database name
리턴 Database

getDbVersion() 공개 메소드

public getDbVersion ( ) : string
리턴 string version of mongo database

getDsn() 공개 메소드

public getDsn ( )

getLogger() 공개 메소드

public getLogger ( ) : Psr\Log\LoggerInterface
리턴 Psr\Log\LoggerInterface

getMongoClient() 공개 메소드

Get mongo connection instance
public getMongoClient ( ) : MongoClient
리턴 MongoClient

getReadPreference() 공개 메소드

public getReadPreference ( )

getVersion() 공개 메소드

public getVersion ( ) : string
리턴 string Version of PHP driver

getWriteConcern() 공개 메소드

Get currently active write concern on connection level
public getWriteConcern ( ) : string | integer
리턴 string | integer

hasLogger() 공개 메소드

Check if logger defined
public hasLogger ( ) : boolean
리턴 boolean

isDebugEnabled() 공개 메소드

Check state of debug mode
public isDebugEnabled ( )

map() 공개 메소드

Collection name -> array definition: ['acmeDatabaseName' => ['acmeCollectionName' => ['class' => '\Acme\Collection\SomeCollectionClass']]] Collection name -> collection class name (deprecated: use definition array): ['acmeDatabaseName' => ['acmeCollectionName' => '\Acme\Collection\SomeCollectionClass']] Collection's class namespace (deprecated: use definition array): ['acmeDatabaseName' => '\Acme\Collection']
public map ( array $mapping ) : Client
$mapping array classpath or class prefix
리턴 Client

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

removeLogger() 공개 메소드

Remove logger
public removeLogger ( ) : Client
리턴 Client

setConnectOptions() 공개 메소드

Set connect options
public setConnectOptions ( array $options ) : Client
$options array
리턴 Client

setCredentials() 공개 메소드

If not specified - auth on admin db
public setCredentials ( type $username, type $password ) : Client
$username type
$password type
리턴 Client

setDsn() 공개 메소드

public setDsn ( $dsn )

setLogger() 공개 메소드

public setLogger ( Psr\Log\LoggerInterface $logger )
$logger Psr\Log\LoggerInterface

setMajorityWriteConcern() 공개 메소드

Define majority write concern on whole requests
public setMajorityWriteConcern ( integer $timeout = 10000 ) : Client
$timeout integer timeout in milliseconds
리턴 Client

setMongoClient() 공개 메소드

Set mongo's client
public setMongoClient ( MongoClient $client ) : Client
$client MongoClient
리턴 Client

setUnacknowledgedWriteConcern() 공개 메소드

Define unacknowledged write concern on whole requests
public setUnacknowledgedWriteConcern ( integer $timeout = 10000 ) : Client
$timeout integer timeout in milliseconds
리턴 Client

setWriteConcern() 공개 메소드

Define write concern on whole requests
public setWriteConcern ( string | integer $w, integer $timeout = 10000 ) : Client
$w string | integer write concern
$timeout integer timeout in milliseconds
리턴 Client

useDatabase() 공개 메소드

Select database
public useDatabase ( string $name ) : Client
$name string
리턴 Client