Mihai
Mihai

Reputation: 2760

Mongodb .net async await

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?

Upvotes: 3

Views: 5516

Answers (2)

vNext
vNext

Reputation: 1122

2.0 Driver is released. Check it out:

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

Nuget:

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

Upvotes: 4

André Bires
André Bires

Reputation: 251

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

Upvotes: 4

Related Questions