I am using ASP.net Web API and MongoDB to create a simple service.
I am using the official Mongodb C# library.
How can I make it Async? I think the official Mongodb C# library does not support Async.
Can I just make the controller Async but not the select statement?
Controller:
public IQueryable<Test> GetAllPlaces()
{
return _test.GetAllPlaces().AsQueryable();
}
Select from mongodb database:
public IEnumerable<Test> GetAllPlaces()
{
return _test.FindAll();
}
Thank you.
While you could make it async, doing so won't provide you any real performance gains as the underlying library isn't Async. There's a lot more to it and is described well here. The general answer is "no."