Devoted to the mongodb embedding component.


MongoDb embedded into an assemly that handles the extraction and execution of mongod.exe as a single class.
It can be downloaded or fetched via NuGet: http://nuget.org/List/Packages/DataDuctus.MongoDb.Embedding

static void Main()
{
  // This will extract mongod.exe (arch *sensitive*) into BinPath 
  // and store db:s in DbPath, Log onto LogFilePath
  // and listen to the loopback interface only.
  // Note: ExtraArguments and WorkingDirectory may also be set among others
  using(var embeddedServer = new EmbeddedMongoDbServer
  {
    BinPath = Directory.GetCurrentDirectory(),
    DbPath = Path.Combine(Directory.GetCurrentDirectory(), "theDb"),
    LogFilePath = Path.Combine(Directory.GetCurrentDirectory(), "mongodb.log"),
    BindIp = "127.0.0.1"
  })
  {
    embeddedServer.Open();

    // Use the mongo server here

  } // process mongod.exe gets shutdown here
}

Last edited Aug 17, 2012 at 6:58 AM by solo95, version 3

Comments

No comments yet.