title: Mongodb configuration from MVC
body: <p>I'm new to Mongodb, I'm following a tutorial now, but I'm afraid that the tutorial is a little bit old, I'm getting this error:
  <code>Cannot implicitly convert type 'MongoDB.Driver.IMongoDatabase' to 'MongoDB.Driver.MongoDatabase'. An explicit conversion exists (are you missing a cast?)</code>
  This is my code inside my controller class:</p>
  
  <pre><code> public class HomeController : Controller
      {
          public MongoDatabase Database;
          public HomeController()
          {
              var client = new MongoClient(Settings.Default.RealEstateConnectionString);
              Database = client.GetDatabase(Settings.Default.RealEstateDatabaseName); //This is the line with the error...            
          }
          public ActionResult Index()
          {
              Database.GetStats();
              return Json(Database.Server.BuildInfo, JsonRequestBehavior.AllowGet);          
          }
  }
  </code></pre>
  
  <p>In the tutorial they are using this:</p>
  
  <pre><code> var server = client.GetServer();//Shows a warning: MongoClientExtensions.GetServer(MongoClient) is obsolete: Use the new API instead
  </code></pre>
  
  <p>and then:</p>
  
  <pre><code>Database = server.GetDatabase(Settings.Default.RealEstateDatabaseName);
  </code></pre>
  
  <p>but according to the warning the use of </p>
  
  <pre><code>var server = client.GetServer();
  </code></pre>
  
  <p>is obsolete so I need to do it on the other way like I showed firstly, I've tried to cast to <code>MongoDatabase</code> but it doesn't work...</p>