Following a tutorial from Macoratti here , errors appear in three types. I do not know what to add to solve it. I did a Copy and Paste and gave an error. Below the code:
using MongoDB.Driver;
using System;
using System.Configuration;
namespace Mvc_MongoDB.Models
{
public class PaisDB
{
public MongoDatabase Database;
public String DataBaseName = "PaisDB";
string conexaoMongoDB = "";
public PaisDB()
{
conexaoMongoDB = ConfigurationManager.ConnectionStrings["conexaoMongoDB"].ConnectionString;
var cliente = new MongoClient(conexaoMongoDB);
var server = cliente.GetServer();
Database = server.GetDatabase(DataBaseName);
}
public MongoCollection<Pais> Paises
{
get
{
var Paises = Database.GetCollection<Pais>("Paises");
return Paises;
}
}
}
}
Error here: MongoDatabase = > Type or Namespace can not be found
Error here: GetServer = > MongoClient does not contain a definition for GetServer
Error here: MongoCollection = > Type or Namespace can not be found
How do I resolve this?