Created
March 25, 2023 16:57
-
-
Save asimmon/8b6988b68c9f855138767c9e91cfb7e5 to your computer and use it in GitHub Desktop.
EphemeralMongo blog post example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var options = new MongoRunnerOptions | |
{ | |
UseSingleNodeReplicaSet = true, | |
StandardOuputLogger = Console.WriteLine, | |
StandardErrorLogger = Console.WriteLine, | |
}; | |
using (var runner = MongoRunner.Run(options)) | |
{ | |
var database = new MongoClient(runner.ConnectionString).GetDatabase("mydb"); | |
database.CreateCollection("people"); | |
runner.Export("mydb", "people", "/path/to/mydb-people.json"); | |
runner.Import("mydb", "people", "/path/to/mydb-people.json"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment