From 4764052a102a0e9312f1df345703207d86a5ce1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boris=20Mom=C4=8Dilovi=C4=87?= Date: Tue, 3 Nov 2015 20:47:58 +0100 Subject: [PATCH] MongoDBHandler: write: call proper method if we've got instance of MongoDB\Collection --- src/Monolog/Handler/MongoDBHandler.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Monolog/Handler/MongoDBHandler.php b/src/Monolog/Handler/MongoDBHandler.php index 84dbdda3..56fe755b 100644 --- a/src/Monolog/Handler/MongoDBHandler.php +++ b/src/Monolog/Handler/MongoDBHandler.php @@ -42,7 +42,11 @@ class MongoDBHandler extends AbstractProcessingHandler protected function write(array $record) { - $this->mongoCollection->save($record["formatted"]); + if ($this->mongoCollection instanceof \MongoDB\Collection) { + $this->mongoCollection->insertOne($record["formatted"]); + } else { + $this->mongoCollection->save($record["formatted"]); + } } /**