PHP 클래스 MongoDB

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

보호된 프로퍼티들

프로퍼티 타입 설명
$connection MongoClient
$db MongoDB\Database
$name string

공개 메소드들

메소드 설명
__construct ( MongoClient $conn, string $name ) Creates a new database
__get ( string $name ) : MongoCollection Gets a collection
__set ( string $name, mixed $value )
__sleep ( ) : array
__toString ( ) : string The name of this database
authenticate ( string $username, string $password ) : array Log in to this database
command ( array $data, array $options = [], &$hash = null ) : array Execute a database command
createCollection ( string $name, array $options ) : MongoCollection Creates a collection
createDBRef ( string $collection, mixed $document_or_id ) : array Creates a database reference
drop ( ) : array Drops this database
dropCollection ( MongoCollection | string $coll ) : array Drops a collection
execute ( MongoCode | string $code, array $args = [] ) : array Runs JavaScript code on the database server.
forceError ( ) : boolean Creates a database error
getCollectionInfo ( array $options = [] ) : array Returns information about collections in this database
getCollectionNames ( array $options = [] ) : array Get all collections from this database
getConnection ( ) : MongoClient
getDBRef ( array $ref ) : array Fetches the document pointed to by a database reference
getDb ( ) : MongoDB\Database
getGridFS ( string $prefix = "fs" ) : MongoGridFS Fetches toolkit for dealing with files stored in this database
getProfilingLevel ( ) : integer Gets this database's profiling level
lastError ( ) : array Check if there was an error on the most recent db operation performed
listCollections ( array $options = [] ) : MongoCollection[] Get a list of collections in this database
prevError ( ) : array Checks for the last error thrown during a database operation
repair ( boolean $preserve_cloned_files = FALSE, boolean $backup_original_files = FALSE ) : array Repairs and compacts this database
resetError ( ) : array Clears any flagged errors on the database
selectCollection ( string $name ) : MongoCollection Gets a collection
setProfilingLevel ( integer $level ) : integer Sets this database's profiling level
setReadPreference ( $readPreference, $tags = null )
setWriteConcern ( $wstring, $wtimeout )

보호된 메소드들

메소드 설명
notImplemented ( )

비공개 메소드들

메소드 설명
checkDatabaseName ( $name )
createDatabaseObject ( ) : MongoDB\Database
getSystemCollectionFilterClosure ( boolean $includeSystemCollections = false ) : Closure

메소드 상세

__construct() 공개 메소드

This method is not meant to be called directly. The preferred way to create an instance of MongoDB is through {@see \Mongo::__get()} or {@see \Mongo::selectDB()}.
public __construct ( MongoClient $conn, string $name )
$conn MongoClient Database connection.
$name string Database name.

__get() 공개 메소드

Gets a collection
public __get ( string $name ) : MongoCollection
$name string The name of the collection.
리턴 MongoCollection

__set() 공개 메소드

public __set ( string $name, mixed $value )
$name string
$value mixed

__sleep() 공개 메소드

public __sleep ( ) : array
리턴 array

__toString() 공개 메소드

The name of this database
public __toString ( ) : string
리턴 string Returns this database's name.

authenticate() 공개 메소드

Log in to this database
사용 중단: This method is not implemented, supply authentication credentials through the connection string instead.
public authenticate ( string $username, string $password ) : array
$username string The username.
$password string The password (in plaintext).
리턴 array Returns database response. If the login was successful, it will return 1.

command() 공개 메소드

Execute a database command
public command ( array $data, array $options = [], &$hash = null ) : array
$data array The query to send.
$options array
리턴 array Returns database response.

createCollection() 공개 메소드

Creates a collection
public createCollection ( string $name, array $options ) : MongoCollection
$name string The name of the collection.
$options array
리턴 MongoCollection Returns a collection object representing the new collection.

createDBRef() 공개 메소드

Creates a database reference
public createDBRef ( string $collection, mixed $document_or_id ) : array
$collection string The collection to which the database reference will point.
$document_or_id mixed
리턴 array Returns a database reference array.

drop() 공개 메소드

Drops this database
public drop ( ) : array
리턴 array Returns the database response.

dropCollection() 공개 메소드

Drops a collection
사용 중단: Use MongoCollection::drop() instead.
public dropCollection ( MongoCollection | string $coll ) : array
$coll MongoCollection | string MongoCollection or name of collection to drop.
리턴 array Returns the database response.

execute() 공개 메소드

Runs JavaScript code on the database server.
public execute ( MongoCode | string $code, array $args = [] ) : array
$code MongoCode | string Code to execute.
$args array [optional] Arguments to be passed to code.
리턴 array Returns the result of the evaluation.

forceError() 공개 메소드

Creates a database error
public forceError ( ) : boolean
리턴 boolean Returns the database response.

getCollectionInfo() 공개 메소드

Returns information about collections in this database
public getCollectionInfo ( array $options = [] ) : array
$options array An array of options for listing the collections.
리턴 array

getCollectionNames() 공개 메소드

Get all collections from this database
public getCollectionNames ( array $options = [] ) : array
$options array An array of options for listing the collections.
리턴 array Returns the names of the all the collections in the database as an array

getConnection() 공개 메소드

public getConnection ( ) : MongoClient
리턴 MongoClient

getDBRef() 공개 메소드

Fetches the document pointed to by a database reference
public getDBRef ( array $ref ) : array
$ref array A database reference.
리턴 array Returns the document pointed to by the reference.

getDb() 공개 메소드

public getDb ( ) : MongoDB\Database
리턴 MongoDB\Database

getGridFS() 공개 메소드

Fetches toolkit for dealing with files stored in this database
public getGridFS ( string $prefix = "fs" ) : MongoGridFS
$prefix string The prefix for the files and chunks collections.
리턴 MongoGridFS Returns a new gridfs object for this database.

getProfilingLevel() 공개 메소드

Gets this database's profiling level
public getProfilingLevel ( ) : integer
리턴 integer Returns the profiling level.

lastError() 공개 메소드

Check if there was an error on the most recent db operation performed
public lastError ( ) : array
리턴 array Returns the error, if there was one.

listCollections() 공개 메소드

Get a list of collections in this database
public listCollections ( array $options = [] ) : MongoCollection[]
$options array
리턴 MongoCollection[] Returns a list of MongoCollections.

notImplemented() 보호된 메소드

protected notImplemented ( )

prevError() 공개 메소드

Checks for the last error thrown during a database operation
public prevError ( ) : array
리턴 array Returns the error and the number of operations ago it occurred.

repair() 공개 메소드

Repairs and compacts this database
public repair ( boolean $preserve_cloned_files = FALSE, boolean $backup_original_files = FALSE ) : array
$preserve_cloned_files boolean [optional]

If cloned files should be kept if the repair fails.

$backup_original_files boolean [optional]

If original files should be backed up.

리턴 array

Returns db response.

resetError() 공개 메소드

Clears any flagged errors on the database
public resetError ( ) : array
리턴 array Returns the database response.

selectCollection() 공개 메소드

Gets a collection
public selectCollection ( string $name ) : MongoCollection
$name string The collection name.
리턴 MongoCollection Returns a new collection object.

setProfilingLevel() 공개 메소드

Sets this database's profiling level
public setProfilingLevel ( integer $level ) : integer
$level integer Profiling level.
리턴 integer Returns the previous profiling level.

setReadPreference() 공개 메소드

public setReadPreference ( $readPreference, $tags = null )

setWriteConcern() 공개 메소드

public setWriteConcern ( $wstring, $wtimeout )

프로퍼티 상세

$connection 보호되어 있는 프로퍼티

protected MongoClient $connection
리턴 MongoClient

$db 보호되어 있는 프로퍼티

protected Database,MongoDB $db
리턴 MongoDB\Database

$name 보호되어 있는 프로퍼티

protected string $name
리턴 string