Skip to content

Commit 22e0480

Browse files
author
Will Banfield
committed
PHPLIB-149: implement find on files collection
1 parent 2f76c46 commit 22e0480

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/GridFS/Bucket.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,6 @@ public function getWriteConcern()
128128
}
129129
}
130130

131-
public function find($filter, array $options =[])
132-
{
133-
//add proper validation for the filter and for the options
134-
return $this->filesCollection->find($filter);
135-
}
136-
137131
private function ensureIndexes()
138132
{
139133
if ($this->ensuredIndexes) {

src/GridFS/BucketReadWriter.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,14 @@ public function downloadToStreamByName($filename, $destination, $revision=-1)
112112
$gridFsStream = new GridFsDownload($this->bucket, null, $file);
113113
$gridFsStream->downloadToStream($destination);
114114
}
115-
115+
/**
116+
* Find files from the GridFS bucket files collection.
117+
*
118+
* @param array $filter filter to find by
119+
* @param array $options options to
120+
*/
121+
public function find($filter, array $options =[])
122+
{
123+
return $this->bucket->getFilesCollection()->find($filter, $options);
124+
}
116125
}

0 commit comments

Comments
 (0)