Verify.MongoDB
8.0.2
Prefix Reserved
dotnet add package Verify.MongoDB --version 8.0.2
NuGet\Install-Package Verify.MongoDB -Version 8.0.2
<PackageReference Include="Verify.MongoDB" Version="8.0.2" />
<PackageVersion Include="Verify.MongoDB" Version="8.0.2" />
<PackageReference Include="Verify.MongoDB" />
paket add Verify.MongoDB --version 8.0.2
#r "nuget: Verify.MongoDB, 8.0.2"
#:package Verify.MongoDB@8.0.2
#addin nuget:?package=Verify.MongoDB&version=8.0.2
#tool nuget:?package=Verify.MongoDB&version=8.0.2
Verify.MongoDB
Extends Verify to allow verification of MongoDB bits.
Verify.MongoDB is heavily inspired by @SimonCropp's Verify.EntityFramework
Enable
Enable VerifyMongoDb once at assembly load time:
VerifyMongoDb.Enable();
Recording
Recording allows all commands executed by the MongoDB driver to be captured and then (optionally) verified.
Call MongoDbRecording.EnableRecording() on MongoClientSettings.
var clientSettings = MongoClientSettings.FromUrl(new MongoUrl(configuration["MongoConnectionString"]));
clientSettings.EnableRecording();
By default, all three event types (Started, Succeeded and Failed) are recorded. You can optionally specify the events required.
clientSettings.EnableRecording(MongoDbEvents.Succeeded | MongoDbEvents.Failed);
EnableRecording should only be called in the test context.
Usage
To start recording call MongoDbRecording.StartRecording(). The results will be automatically included in the verified file.
MongoDBRecording.StartRecording();
await collection.FindAsync(Builders<BsonDocument>.Filter.Eq("_id", "blah"),
new FindOptions<BsonDocument, BsonDocument>());
await Verifier.Verify("collection");
Will result in the following verified file:
{
target: collection,
mongo: [
{
Database: VerifyTests,
Document: {
filter: {
_id: blah
},
find: docs
},
Type: Started,
Command: find,
StartTime: DateTimeOffset_1,
OperationId: Id_1,
RequestId: Id_2
},
{
Document: {
cursor: {
firstBatch: [],
id: 0,
ns: VerifyTests.docs
},
ok: 1.0
},
Type: Succeeded,
Command: find,
StartTime: DateTimeOffset_2,
OperationId: Id_1,
RequestId: Id_2
}
]
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- MongoDB.Driver (>= 3.1.0)
- Verify (>= 31.8.0)
-
net6.0
- MongoDB.Driver (>= 3.1.0)
- Verify (>= 31.8.0)
-
net8.0
- MongoDB.Driver (>= 3.1.0)
- Verify (>= 31.8.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 8.0.2 | 141 | 12/6/2025 |
| 7.0.70 | 129 | 12/6/2025 |
| 7.0.8 | 244 | 10/13/2025 |
| 7.0.2 | 187 | 10/13/2025 |
| 6.0.72 | 187 | 10/13/2025 |
| 6.0.68 | 138 | 10/11/2025 |
| 6.0.66 | 193 | 10/9/2025 |
| 6.0.26 | 211 | 9/10/2025 |
| 6.0.8 | 212 | 8/13/2025 |
| 6.0.6 | 293 | 8/6/2025 |
| 6.0.2 | 210 | 7/15/2025 |
| 5.0.24 | 211 | 7/15/2025 |
| 5.0.12 | 955 | 1/11/2025 |
| 5.0.6 | 185 | 1/11/2025 |
| 5.0.2 | 194 | 1/11/2025 |
| 4.0.52 | 558 | 12/18/2024 |
| 4.0.12 | 490 | 8/29/2024 |
| 4.0.10 | 195 | 8/29/2024 |
| 4.0.2 | 208 | 8/8/2024 |
| 3.0.167 | 897 | 4/25/2024 |
| 3.0.155 | 777 | 2/7/2024 |
| 3.0.151 | 297 | 1/26/2024 |
| 3.0.149 | 187 | 1/26/2024 |
| 3.0.147 | 200 | 1/26/2024 |
| 3.0.137 | 261 | 12/17/2023 |
| 3.0.135 | 208 | 12/17/2023 |
| 3.0.133 | 216 | 12/17/2023 |
| 3.0.131 | 203 | 12/17/2023 |
| 3.0.105 | 212 | 9/15/2023 |
| 3.0.85 | 251 | 6/24/2023 |
| 3.0.23 | 1,963 | 3/4/2023 |
| 3.0.18 | 358 | 3/4/2023 |
| 3.0.2 | 737 | 2/6/2023 |
| 2.0.99 | 411 | 2/6/2023 |
| 2.0.82 | 551 | 10/5/2022 |
| 2.0.2 | 678 | 6/3/2022 |
| 1.0.79 | 682 | 4/28/2022 |
| 1.0.75 | 645 | 4/16/2022 |
| 1.0.73 | 639 | 3/30/2022 |
| 1.0.71 | 643 | 3/30/2022 |