I'm trying to develop .net desktop application in C#. The data that I'm using in this app is stored in a mongodb collection. I can display data in a datagridview, I can add rows in this datagridview but, I'm not able to reflect this change to my mongodb collection.
My collection : Stations and in doclist I store the documents from this collection.Here is a part of my code where I show data in the datagridview:
Mongo mongo = new Mongo();
mongo.Connect();
var database = mongo.GetDatabase("test");
var collection2 = database.GetCollection<Stations>("Stations");
BindingList<Stations> doclist = new BindingList<Stations>();
foreach (Stations stat in collection2.FindAll().Documents)
{
doclist.Add(stat);
}
dataGridView1.DataSource = doclist;
Does anyone have an idea about this?