Method | Description | |
---|---|---|
__construct ( MongoDB\Driver\Manager $manager, string $databaseName, string $bucketName, array $collectionOptions = [] ) | Constructs a GridFS collection wrapper. | |
deleteChunksByFilesId ( mixed $id ) | Deletes all GridFS chunks for a given file ID. | |
deleteFileAndChunksById ( mixed $id ) | Deletes a GridFS file and related chunks by ID. | |
dropCollections ( ) | Drops the GridFS files and chunks collections. | |
findFileByFilenameAndRevision ( string $filename, integer $revision ) : stdClas\stdClass | null | Finds a GridFS file document for a given filename and revision. | |
findFileById ( mixed $id ) : stdClas\stdClass | null | Finds a GridFS file document for a given ID. | |
findFiles ( array | object $filter, array $options = [] ) : MongoDB\Driver\Cursor | Finds documents from the GridFS bucket's files collection. | |
getChunksCollection ( ) | TODO: Remove this | |
getChunksIteratorByFilesId ( mixed $id ) : IteratorIterator | Returns a chunks iterator for a given file ID. | |
getFilesCollection ( ) | TODO: Remove this | |
insertChunk ( array | object $chunk ) | Inserts a document into the chunks collection. | |
insertFile ( array | object $file ) | Inserts a document into the files collection. | |
updateFilenameForId ( mixed $id, string $filename ) : |
Updates the filename field in the file document for a given ID. |
Method | Description | |
---|---|---|
ensureChunksIndex ( ) | Create an index on the chunks collection if it does not already exist. | |
ensureFilesIndex ( ) | Create an index on the files collection if it does not already exist. | |
ensureIndexes ( ) | Ensure indexes on the files and chunks collections exist. | |
isFilesCollectionEmpty ( ) : boolean | Returns whether the files collection is empty. |
public __construct ( MongoDB\Driver\Manager $manager, string $databaseName, string $bucketName, array $collectionOptions = [] ) | ||
$manager | MongoDB\Driver\Manager | Manager instance from the driver |
$databaseName | string | Database name |
$bucketName | string | Bucket name |
$collectionOptions | array | Collection options |
public deleteChunksByFilesId ( mixed $id ) | ||
$id | mixed |
public deleteFileAndChunksById ( mixed $id ) | ||
$id | mixed |
public dropCollections ( ) |
public findFileById ( mixed $id ) : stdClas\stdClass | null | ||
$id | mixed | |
return | stdClas\stdClass | null |
public getChunksIteratorByFilesId ( mixed $id ) : IteratorIterator | ||
$id | mixed | |
return | IteratorIterator |
public insertChunk ( array | object $chunk ) | ||
$chunk | array | object | Chunk document |
public insertFile ( array | object $file ) | ||
$file | array | object | File document |
public updateFilenameForId ( mixed $id, string $filename ) : |
||
$id | mixed | |
$filename | string | |
return |