Differences Between: [Versions 310 and 400] [Versions 39 and 400] [Versions 400 and 401]
(no description)
File Size: | 559 lines (20 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
Database:: (22 methods):
__construct()
__debugInfo()
__get()
__toString()
aggregate()
command()
createCollection()
drop()
dropCollection()
getDatabaseName()
getManager()
getReadConcern()
getReadPreference()
getTypeMap()
getWriteConcern()
listCollectionNames()
listCollections()
modifyCollection()
selectCollection()
selectGridFSBucket()
watch()
withOptions()
__construct(Manager $manager, $databaseName, array $options = []) X-Ref |
Constructs new Database instance. 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. param: Manager $manager Manager instance from the driver param: string $databaseName Database name param: array $options Database options |
__debugInfo() X-Ref |
Return internal properties for debugging purposes. return: array |
__get($collectionName) X-Ref |
Select a collection within this database. Note: collections whose names contain special characters (e.g. ".") may be selected with complex syntax (e.g. $database->{"system.profile"}) or {@link selectCollection()}. return: Collection param: string $collectionName Name of the collection to select |
__toString() X-Ref |
Return the database name. return: string |
aggregate(array $pipeline, array $options = []) X-Ref |
Runs an aggregation framework pipeline on the database for pipeline stages that do not require an underlying collection, such as $currentOp and $listLocalSessions. Requires MongoDB >= 3.6 return: Traversable param: array $pipeline List of pipeline operations param: array $options Command options |
command($command, array $options = []) X-Ref |
Execute a command on this database. return: Cursor param: array|object $command Command document param: array $options Options for command execution |
createCollection($collectionName, array $options = []) X-Ref |
Create a new collection explicitly. return: array|object Command result document param: string $collectionName param: array $options |
drop(array $options = []) X-Ref |
Drop this database. return: array|object Command result document param: array $options Additional options |
dropCollection($collectionName, array $options = []) X-Ref |
Drop a collection within this database. return: array|object Command result document param: string $collectionName Collection name param: array $options Additional options |
getDatabaseName() X-Ref |
Returns the database name. return: string |
getManager() X-Ref |
Return the Manager. return: Manager |
getReadConcern() X-Ref |
Return the read concern for this database. return: ReadConcern |
getReadPreference() X-Ref |
Return the read preference for this database. return: ReadPreference |
getTypeMap() X-Ref |
Return the type map for this database. return: array |
getWriteConcern() X-Ref |
Return the write concern for this database. return: WriteConcern |
listCollectionNames(array $options = []) X-Ref |
Returns the names of all collections in this database |
listCollections(array $options = []) X-Ref |
Returns information for all collections in this database. return: CollectionInfoIterator param: array $options |
modifyCollection($collectionName, array $collectionOptions, array $options = []) X-Ref |
Modifies a collection or view. return: array|object param: string $collectionName Collection or view to modify param: array $collectionOptions Collection or view options to assign param: array $options Command options |
selectCollection($collectionName, array $options = []) X-Ref |
Select a collection within this database. return: Collection param: string $collectionName Name of the collection to select param: array $options Collection constructor options |
selectGridFSBucket(array $options = []) X-Ref |
Select a GridFS bucket within this database. return: Bucket param: array $options Bucket constructor options |
watch(array $pipeline = [], array $options = []) X-Ref |
Create a change stream for watching changes to the database. return: ChangeStream param: array $pipeline List of pipeline operations param: array $options Command options |
withOptions(array $options = []) X-Ref |
Get a clone of this database with different options. return: Database param: array $options Database constructor options |