I want to pass data from a collection to a viewbag from mongoDB. How can I do the query (limit 1) to assign the result to the viewbag variable?
For example I want to pass the following query in LINQ
db.getCollection('monitoreo').find({valor:'002'}).limit(1)
I leave the example of my controller which returns the entire list and I pass to the view
public ActionResult Index()
{
List<monitoreoModel> monitoreo = monitoreoCollection.AsQueryable<monitoreoModel>().ToList();
return View(monitoreo);
}
Please help, thanks!