Skip to content

Commit 63b1794

Browse files
committed
Add ConnectionCount and DriverTitle for monitoring commands
1 parent 046b92a commit 63b1794

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/Connection.php

+5
Original file line numberDiff line numberDiff line change
@@ -361,4 +361,9 @@ private static function lookupVersion(): string
361361
return self::$version = 'error';
362362
}
363363
}
364+
365+
public function getDriverTitle()
366+
{
367+
return 'MongoDB';
368+
}
364369
}

src/Schema/Builder.php

+11
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace MongoDB\Laravel\Schema;
66

77
use Closure;
8+
use Illuminate\Database\Connection;
89
use MongoDB\Model\CollectionInfo;
910
use MongoDB\Model\IndexInfo;
1011

@@ -289,4 +290,14 @@ protected function getAllCollections()
289290

290291
return $collections;
291292
}
293+
294+
public function getConnectionCount()
295+
{
296+
$status = $this->connection
297+
->getMongoDB()
298+
->command(['serverStatus' => 1])
299+
->toArray();
300+
301+
return $status[0]['connections']['current'];
302+
}
292303
}

0 commit comments

Comments
 (0)