1
Accompanying a Macoratti tutorial here, errors appear in three types. I don’t know what to add to solve. I Copy and Paste and gave 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;
}
}
}
}
Mistake here: Mongodatabase => Type or Namespace cannot be found
Mistake here: Getserver => Mongoclient does not contain a definition for Getserver
Mistake here: Mongocollection => Type or Namespace cannot be found
How do I fix it?