Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401]
(no description)
File Size: | 350 lines (9 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
CollectionWrapper:: (20 methods):
__construct()
deleteChunksByFilesId()
deleteFileAndChunksById()
dropCollections()
findChunksByFileId()
findFileByFilenameAndRevision()
findFileById()
findFiles()
findOneFile()
getBucketName()
getChunksCollection()
getDatabaseName()
getFilesCollection()
insertChunk()
insertFile()
updateFilenameForId()
ensureChunksIndex()
ensureFilesIndex()
ensureIndexes()
isFilesCollectionEmpty()
Class: CollectionWrapper - X-Ref
CollectionWrapper abstracts the GridFS files and chunks collections.__construct(Manager $manager, $databaseName, $bucketName, array $collectionOptions = []) X-Ref |
Constructs a GridFS collection wrapper. param: Manager $manager Manager instance from the driver param: string $databaseName Database name param: string $bucketName Bucket name param: array $collectionOptions Collection options |
deleteChunksByFilesId($id) X-Ref |
Deletes all GridFS chunks for a given file ID. param: mixed $id |
deleteFileAndChunksById($id) X-Ref |
Deletes a GridFS file and related chunks by ID. param: mixed $id |
dropCollections() X-Ref |
Drops the GridFS files and chunks collections. |
findChunksByFileId($id, $fromChunk = 0) X-Ref |
Finds GridFS chunk documents for a given file ID and optional offset. param: mixed $id File ID param: integer $fromChunk Starting chunk (inclusive) return: Cursor |
findFileByFilenameAndRevision($filename, $revision) X-Ref |
Finds a GridFS file document for a given filename and revision. Revision numbers are defined as follows: * 0 = the original stored file * 1 = the first revision * 2 = the second revision * etc… * -2 = the second most recent revision * -1 = the most recent revision param: string $filename param: integer $revision return: stdClass|null |
findFileById($id) X-Ref |
Finds a GridFS file document for a given ID. param: mixed $id return: stdClass|null |
findFiles($filter, array $options = []) X-Ref |
Finds documents from the GridFS bucket's files collection. param: array|object $filter Query by which to filter documents param: array $options Additional options return: Cursor |
findOneFile($filter, array $options = []) X-Ref |
Finds a single document from the GridFS bucket's files collection. param: array|object $filter Query by which to filter documents param: array $options Additional options return: array|object|null |
getBucketName() X-Ref |
Return the bucket name. return: string |
getChunksCollection() X-Ref |
Return the chunks collection. return: Collection |
getDatabaseName() X-Ref |
Return the database name. return: string |
getFilesCollection() X-Ref |
Return the files collection. return: Collection |
insertChunk($chunk) X-Ref |
Inserts a document into the chunks collection. param: array|object $chunk Chunk document |
insertFile($file) X-Ref |
Inserts a document into the files collection. The file document should be inserted after all chunks have been inserted. param: array|object $file File document |
updateFilenameForId($id, $filename) X-Ref |
Updates the filename field in the file document for a given ID. param: mixed $id param: string $filename return: UpdateResult |
ensureChunksIndex() X-Ref |
Create an index on the chunks collection if it does not already exist. |
ensureFilesIndex() X-Ref |
Create an index on the files collection if it does not already exist. |
ensureIndexes() X-Ref |
Ensure indexes on the files and chunks collections exist. This method is called once before the first write operation on a GridFS bucket. Indexes are only be created if the files collection is empty. |
isFilesCollectionEmpty() X-Ref |
Returns whether the files collection is empty. return: boolean |