Skip to content

Commit 2ca40c7

Browse files
Will Banfieldjmikola
authored andcommitted
PHPLIB-158: delete removes files document first
1 parent 9089cd9 commit 2ca40c7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/GridFS/Bucket.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ public function __construct(Manager $manager, $databaseName, array $options = []
8787
public function delete(ObjectId $id)
8888
{
8989
$file = $this->collectionsWrapper->getFilesCollection()->findOne(['_id' => $id]);
90+
$this->collectionsWrapper->getFilesCollection()->deleteOne(['_id' => $id]);
9091
$this->collectionsWrapper->getChunksCollection()->deleteMany(['files_id' => $id]);
9192

9293
if ($file === null) {
9394
throw new GridFSFileNotFoundException($id, $this->collectionsWrapper->getFilesCollection()->getNameSpace());
9495
}
9596

96-
$this->collectionsWrapper->getFilesCollection()->deleteOne(['_id' => $id]);
9797
}
9898

9999
/**

0 commit comments

Comments
 (0)