diff --git a/src/Client.php b/src/Client.php index 7481249..9d7884f 100644 --- a/src/Client.php +++ b/src/Client.php @@ -228,6 +228,16 @@ public function connect(): self return $this; } + /** + * Return client's host + * + * @return string + */ + public function getHost(): string + { + return $this->host; + } + /** * Create a UUID using UUID7 standard for MongoDB _id field. * diff --git a/tests/MongoTest.php b/tests/MongoTest.php index 2d48716..afc073c 100644 --- a/tests/MongoTest.php +++ b/tests/MongoTest.php @@ -41,6 +41,10 @@ public function testDeleteDatabase() self::assertTrue($this->getDatabase()->dropDatabase()); } + public function testGetHost() + { + self::assertSame('mongo', $this->getDatabase()->getHost()); + } /** * @throws Exception