-
StackOverflow 文档
-
mongodb-csharp 教程
-
MongoDB 中的 CRUD 操作 C#
-
插入文档
var client = new MongoClient("mongodb://localhost:27017");
var database = client.GetDatabase("test");
var collection = database.GetCollection < Interactions > ("Interactions");
var newItem = new Interactions{
SiteName = "Example",
Pages = new List < Pages > {
new Pages {
Url = @ "http://stackoverflow.com/documentation/mongodb-csharp",
VisitPageIndex = 4
},
new Pages {
Url = @ "https://github.com/",
VisitPageIndex = 2
},
}
};
collection.InsertOne(newItem);