2013-01-29 02:07:18 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2013-01-31 03:02:13 +01:00
|
|
|
|
using System.Configuration;
|
2013-01-29 02:07:18 +01:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using MongoDB.Driver;
|
|
|
|
|
|
|
|
|
|
namespace NzbDrone.Services.Api.Datastore
|
|
|
|
|
{
|
|
|
|
|
public class Connection
|
|
|
|
|
{
|
|
|
|
|
public MongoDatabase GetMainDb()
|
|
|
|
|
{
|
2013-01-31 03:02:13 +01:00
|
|
|
|
var db = GetMongoDb(ConfigurationManager.ConnectionStrings["MongoLab"].ConnectionString, "services-dev");
|
2013-01-29 02:07:18 +01:00
|
|
|
|
return db;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MongoDatabase GetMongoDb(string connectionString, string dbName)
|
|
|
|
|
{
|
|
|
|
|
var mongoServer = MongoServer.Create(connectionString);
|
|
|
|
|
var database = mongoServer.GetDatabase(dbName.ToLowerInvariant());
|
|
|
|
|
return database;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|