I'm pulling data from MongoDB in C# Asp.net MVC2. Here is the code I'm using in the controller.
var mongo = new Mongo();
mongo.Connect();
var db = mongo.GetDatabase("DDL");
var Provinces = db.GetCollection("Provinces");
var documents = Provinces.FindAll().Documents;
ViewData["Document"] = documents;
return View();
Now I'm unsure how to read the data out in the view. The documents dictionary should have some value pairs like:
Name: someName,
Lat: 39.1,
Lon: 77,
note: test not
When I add it in the view like so:
<p><%: ViewData["Document"]%></p>
I get the output:
MongoDB.Driver.Cursor+<>c__Iterator0
Can someone point me in the right direction?