public static void Test_MongoDB_Serialize_01() { Data01 data = new Data01 { _id = 123, name = "toto" }; //BsonDocument doc = data.ToBsonDocument(); BsonDocument doc = data.zToBsonDocument(); Trace.WriteLine(doc.ToJson()); }
public static void Test_MongoDB_data01_01() { Trace.WriteLine("Test_MongoDB_data01_01"); MongoDatabase mdb = GetMongoDatabase(); MongoCollection <Data01> collection = mdb.GetCollection <Data01>("data01"); //Data01 data = new Data01 { data_id = 1, name = "tata" }; Data01 data = new Data01 { _id = 1, name = "tata" }; //Trace.WriteLine("save data01 : {0}", data); //collection.Save(data); Trace.WriteLine("insert data01 : {0}", data); collection.Insert(data); }