You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Radarr/NzbDrone.Services.Api/Datastore/Connection.cs

25 lines
703 B

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using MongoDB.Driver;
namespace NzbDrone.Services.Api.Datastore
{
public class Connection
{
public MongoDatabase GetMainDb()
{
var db = GetMongoDb(ConfigurationManager.ConnectionStrings["MongoLab"].ConnectionString, "services-dev");
return db;
}
public MongoDatabase GetMongoDb(string connectionString, string dbName)
{
var mongoServer = MongoServer.Create(connectionString);
var database = mongoServer.GetDatabase(dbName.ToLowerInvariant());
return database;
}
}
}