PHP Class Phalcon\Db\Adapter\MongoDB\Database

Afficher le fichier Open project: phalcon/incubator

Méthodes publiques

Méthode Description
__construct ( MongoDB\Driver\Manager $manager, string $databaseName, array $options = [] ) Constructs new Database instance.
__debugInfo ( ) : array Return internal properties for debugging purposes.
__get ( string $collectionName ) : Collection Select a collection within this database.
__toString ( ) : string Return the database name.
command ( array | object $command, array $options = [] ) : MongoDB\Driver\Cursor Execute a command on this database.
createCollection ( string $collectionName, array $options = [] ) : array | object Create a new collection explicitly.
drop ( array $options = [] ) : array | object Drop this database.
dropCollection ( string $collectionName, array $options = [] ) : array | object Drop a collection within this database.
getDatabaseName ( ) : string Returns the database name.
listCollections ( array $options = [] ) : Phalcon\Db\Adapter\MongoDB\Model\CollectionInfoIterator Returns information for all collections in this database.
selectCollection ( string $collectionName, array $options = [] ) : Collection Select a collection within this database.
withOptions ( array $options = [] ) : Database Get a clone of this database with different options.

Method Details

__construct() public méthode

This class provides methods for database-specific operations and serves as a gateway for accessing collections. Supported options: * readConcern (MongoDB\Driver\ReadConcern): The default read concern to use for database operations and selected collections. Defaults to the Manager's read concern. * readPreference (MongoDB\Driver\ReadPreference): The default read preference to use for database operations and selected collections. Defaults to the Manager's read preference. * typeMap (array): Default type map for cursors and BSON documents. * writeConcern (MongoDB\Driver\WriteConcern): The default write concern to use for database operations and selected collections. Defaults to the Manager's write concern.
public __construct ( MongoDB\Driver\Manager $manager, string $databaseName, array $options = [] )
$manager MongoDB\Driver\Manager Manager instance from the driver
$databaseName string Database name
$options array Database options

__debugInfo() public méthode

Return internal properties for debugging purposes.
See also: http://php.net/manual/en/language.oop5.magic.php#language.oop5.magic.debuginfo
public __debugInfo ( ) : array
Résultat array

__get() public méthode

Note: collections whose names contain special characters (e.g. ".") may be selected with complex syntax (e.g. $database->{"system.profile"}) or {@link selectCollection()}.
See also: http://php.net/oop5.overloading#object.get
See also: http://php.net/types.string#language.types.string.parsing.complex
public __get ( string $collectionName ) : Collection
$collectionName string Name of the collection to select
Résultat Collection

__toString() public méthode

Return the database name.
public __toString ( ) : string
Résultat string

command() public méthode

Execute a command on this database.
See also: DatabaseCommand::__construct() for supported options
public command ( array | object $command, array $options = [] ) : MongoDB\Driver\Cursor
$command array | object Command document
$options array Options for command execution
Résultat MongoDB\Driver\Cursor

createCollection() public méthode

Create a new collection explicitly.
See also: CreateCollection::__construct() for supported options
public createCollection ( string $collectionName, array $options = [] ) : array | object
$collectionName string
$options array
Résultat array | object Command result document

drop() public méthode

Drop this database.
See also: DropDatabase::__construct() for supported options
public drop ( array $options = [] ) : array | object
$options array Additional options
Résultat array | object Command result document

dropCollection() public méthode

Drop a collection within this database.
See also: DropCollection::__construct() for supported options
public dropCollection ( string $collectionName, array $options = [] ) : array | object
$collectionName string Collection name
$options array Additional options
Résultat array | object Command result document

getDatabaseName() public méthode

Returns the database name.
public getDatabaseName ( ) : string
Résultat string

listCollections() public méthode

Returns information for all collections in this database.
See also: ListCollections::__construct() for supported options
public listCollections ( array $options = [] ) : Phalcon\Db\Adapter\MongoDB\Model\CollectionInfoIterator
$options array
Résultat Phalcon\Db\Adapter\MongoDB\Model\CollectionInfoIterator

selectCollection() public méthode

Select a collection within this database.
See also: Collection::__construct() for supported options
public selectCollection ( string $collectionName, array $options = [] ) : Collection
$collectionName string Name of the collection to select
$options array Collection constructor options
Résultat Collection

withOptions() public méthode

Get a clone of this database with different options.
See also: Database::__construct() for supported options
public withOptions ( array $options = [] ) : Database
$options array Database constructor options
Résultat Database