You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

MongoAsyncEnumerableAdapter

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

MongoAsyncEnumerableAdapter

Provides an adapter from MongoDB's IAsyncCursor and IAsyncCursorSource to IAsyncEnumerable

0.2.0
nugetNuGet
Version published
Maintainers
1
Created
Source

MongoAsyncEnumerableAdapter

NuGet NuGet license

Provides an adapter from MongoDB's IAsyncCursor<TDocument> and IAsyncCursorSource<TDocument> to IAsyncEnumerable<T>

This allows plugging MongoDB's custom async iterators into the async LINQ ecosystem by wrapping IAsyncCursorSource<TDocument> or IAsyncCursor<TDocument> in an IAsyncEnumerable<T> implementation.

For example, iterating on a find result with await foreach:

IMongoCollection<Hamster> collection = // ...
IFindFluent<Hamster, Hamster> findFluent = collection.Find(hamster => hamster.Name == "bar");

await foreach (var hamster in findFluent.ToAsyncEnumerable())
{
    Console.WriteLine(hamster.Age);
}

Or any other async LINQ operator:

IMongoCollection<Hamster> collection = // ...

int groupCount = 
    await collection.AsQueryable().
        ToAsyncEnumerable().
        GroupBy(hamster => hamster.Age).
        CountAsync();

Keywords

mongodb

FAQs

Package last updated on 14 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts