From e91c89f0549a4b841268620d88d68df4743568e0 Mon Sep 17 00:00:00 2001 From: Alexandre SPIESER Date: Wed, 1 Nov 2017 08:27:59 +0000 Subject: [PATCH] Update README.md --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 8908539..a2e01ed 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,14 @@ The repository can be instantiated like so: ITestRepository testRepository = new TestRepository(connectionString, "MongoDbTests"); ``` +If you prefer to reuse the same MongoDb database across you application, you can use the `MongoDatabase` from the MongoDb driver implementing the `IMongoDatabase` interface: + +```csharp +var client = new MongoClient(connectionString); +var mongoDbDatabase = Client.GetDatabase(databaseName); +ITestRepository testRepository = new TestRepository(mongoDbDatabase); +``` + ## Adding documents To add a document, its class must inherit from the `Document` class, implement the `IDocument` or `IDocument` interface: