InMemoryEmulator.MongoDB 1.1.4

dotnet add package InMemoryEmulator.MongoDB --version 1.1.4
                    
NuGet\Install-Package InMemoryEmulator.MongoDB -Version 1.1.4
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="InMemoryEmulator.MongoDB" Version="1.1.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="InMemoryEmulator.MongoDB" Version="1.1.4" />
                    
Directory.Packages.props
<PackageReference Include="InMemoryEmulator.MongoDB" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add InMemoryEmulator.MongoDB --version 1.1.4
                    
#r "nuget: InMemoryEmulator.MongoDB, 1.1.4"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package InMemoryEmulator.MongoDB@1.1.4
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=InMemoryEmulator.MongoDB&version=1.1.4
                    
Install as a Cake Addin
#tool nuget:?package=InMemoryEmulator.MongoDB&version=1.1.4
                    
Install as a Cake Tool

<img src="icon.svg" width="32" height="32" alt="InMemoryEmulator.MongoDB icon" style="vertical-align: middle;"> InMemoryEmulator.MongoDB

NuGet License: MIT

A high-fidelity, in-process fake for the MongoDB .NET/C# Driver — zero Docker, zero network, instant startup.

Why?

  • Instant — ~0ms startup (vs 2-15s for Docker/Mongo2Go)
  • Portable — No Docker, no mongod binaries, no ports
  • Reliable — No flaky timeouts, port conflicts, or container failures
  • High-fidelity — Real filter, update, and aggregation semantics (not mocks)

Quick Start

dotnet add package InMemoryEmulator.MongoDB          # for MongoDB.Driver 3.x
dotnet add package InMemoryEmulator.MongoDB.V2Driver  # for MongoDB.Driver 2.x

Unit Tests

var result = InMemoryMongo.Create<Order>("orders");
var collection = result.Collection;

await collection.InsertOneAsync(new Order { Total = 99.99m });
var found = await collection.Find(o => o.Total > 50).FirstOrDefaultAsync();

Integration Tests (DI)

services.UseInMemoryMongoDB(options =>
{
    options.DatabaseName = "testdb";
    options.AddCollection<Order>("orders");
});

What's Supported

Feature Status
Full CRUD (Insert, Find, Update, Replace, Delete, BulkWrite)
Aggregation Pipeline (34 stages, 100+ expression operators)
Indexes (Unique, Compound, Sparse, Partial Filter, TTL)
Change Streams
Transactions (snapshot isolation)
GridFS
Schema Validation ($jsonSchema)
Capped Collections + Tailable Cursors
Views
LINQ (AsQueryable())
Fault Injection
State Persistence (Export/Import)
DI Integration (2 extension methods)

NuGet Packages

Package Description NuGet
InMemoryEmulator.MongoDB Core library for MongoDB.Driver 3.x NuGet Version
InMemoryEmulator.MongoDB.V2Driver Core library for MongoDB.Driver 2.x NuGet Version
InMemoryEmulator.MongoDB.JsTriggers $function, $accumulator, $where via Jint NuGet Version

Both packages share the same namespace (InMemoryEmulator.MongoDB) and feature set. Pick the one matching your driver version — the API is identical.

Documentation

See the Wiki for full documentation:

Requirements

  • .NET 8.0+
  • InMemoryEmulator.MongoDB requires MongoDB.Driver 3.x (tested up to 3.8.1)
  • InMemoryEmulator.MongoDB.V2Driver requires MongoDB.Driver 2.x (tested up to 2.30.0)

License

MIT

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on InMemoryEmulator.MongoDB:

Package Downloads
InMemoryEmulator.MongoDB.JsTriggers

JavaScript expression support for InMemoryEmulator.MongoDB. Uses Jint to execute $function, $accumulator, and $where expressions inside your in-memory tests.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.4 110 5/25/2026
1.1.1 556 5/17/2026
1.1.0 861 5/13/2026
1.0.1 227 5/12/2026