Skip to content

Find one file using the Bucket class #272

@christeredvartsen

Description

@christeredvartsen

MongoDB\GridFS\Bucket::find() forwards to MongoDB\GridFS\CollectionWrapper::findFiles() which in turn forwards to MongoDB\Collection::find(). This method creates a MongoDB\Operation\Find command. The MongoDB\Collection class also has a findOne method which uses the MongoDB\Operation\FindOne command, which is not reachable using MongoDB\GridFS\Bucket or MongoDB\GridFS\CollectionWrapper in the same manner.

It would be nice to have a MongoDB\Bucket::findOne() method as well (I guess one can accomplish the same by specifying ['limit' => 1] as an option to the find method, but still...).

If this is something you would like to include I'd be happy to send a pull request including necessary tests and documentation.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions