我想从客户端在服务器上安装Mongodb C# driver。因此,我必须使用Terminal进行安装。我试图手动下载.nupkg文件,但我无法安装它。
谁能告诉我怎么做?
更新
现在我使用nuget install mongoDB.Driver
和nuget install mongocsharpdriver
我得到了
Successfully installed 'mongocsharpdriver 2.5.0' to /Users/my/project/path
但是当我尝试使用mcs Program.cs
我仍然有这个错误
Program.cs(3,7): error CS0246: The type or namespace name 'MongoDB' could not be found. Are you missing an assembly reference? Program.cs(4,7): error CS0246: The type or namespace name 'MongoDB' could not be found. Are you missing an assembly reference? Program.cs(5,7): error CS0246: The type or namespace name 'MongoDB' could not be found. Are you missing an assembly reference? Program.cs(54,16): error CS0246: The type or namespace name 'ObjectId' could not be found. Are you missing an assembly reference?
任何人都可以帮我解决这个问题吗? 我不知道为什么找不到'MongoDB'。
我的program.cs就像这样
using System;
using System.IO;
using MongoDB.Bson;
using MongoDB.Driver;
namespace testMongo
{
class MainClass
{
public static void Main(string[] args)
{
var connectionString = "mongodb://localhost";
var client = new MongoClient(connectionString);
var database = client.GetDatabase("test");
var collection = database.GetCollection<Entity>("uesr");
}
}
}