1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-09 14:46:46 +02:00

MongoDBHandler: write: call proper method if we've got instance of MongoDB\Collection

This commit is contained in:
Boris Momčilović
2015-11-03 20:47:58 +01:00
parent e099fce150
commit 4764052a10

View File

@@ -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"]);
}
}
/**