3

Does the mongodb .net driver offer support for async/await operations? I can't seem to find any info on this. I'm looking for something like EntityFramework has:

ToListAsync(), FindAsync(), CountAsync()

Is this supported?

2
  • I couldn't find any solution, did you? thanks Commented Apr 11, 2019 at 15:40
  • I haven't used MongoDB in years, but it appears that the new drivers offer async support github.com/mongodb/mongo-csharp-driver Commented Apr 12, 2019 at 8:08

2 Answers 2

4

2.0 Driver is released. Check it out:

https://github.com/mongodb/mongo-csharp-driver

Nuget:

https://www.nuget.org/packages/MongoDB.Driver

Sign up to request clarification or add additional context in comments.

Comments

4

I've made some changes in the official driver to make it async as possible. Basically, I've changed the MongoConnection class to use the NetworkStream async methods (WriteAsync and ReadAsync) and propagated the changes all by the code.

Besides that, I've added the async LINQ methods like the EF6 (I actually took the extensions from the EF code and adapted to the mongo driver).

It's not production quality, but it's working.

https://github.com/andrebires/mongo-csharp-driver

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.