Skip to content

Commit 380e222

Browse files
committed
Conditionally use Collection getter by version
1 parent ac1cca1 commit 380e222

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Monolog/Handler/MongoDBHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class MongoDBHandler extends AbstractProcessingHandler
5151
public function __construct(Client|Manager $mongodb, string $database, string $collection, int|string|Level $level = Level::Debug, bool $bubble = true)
5252
{
5353
if ($mongodb instanceof Client) {
54-
$this->collection = $mongodb->getCollection($database, $collection);
54+
$mongodb->(method_exists($mongodb, 'getCollection') ? 'getCollection' : 'selectCollection')($database, $collection);
5555
} else {
5656
$this->manager = $mongodb;
5757
$this->namespace = $database . '.' . $collection;

0 commit comments

Comments
 (0)