<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Wed Feb 07 21:35:55 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[CSHARP-138] Add asynchronous APIs</title>
                <link>https://jira.mongodb.org/browse/CSHARP-138</link>
                <project id="10041" key="CSHARP">C# Driver</project>
                    <description>&lt;p&gt;C# 5.0 is all about making asynchronous programming a first class citizen of the language. Also, writing scalable server applications requires using only asynchronous I/O. This can only be done if the MongoDB driver exposes asynchronous operations for querying the database.&lt;/p&gt;

&lt;p&gt;In order to make it compatible with what C# 5.0 will be using, those APIs will need to use the task based pattern, and return Task&amp;lt;T&amp;gt;.&lt;br/&gt;
For exemple,&lt;/p&gt;

&lt;p&gt;public MongoCursor&amp;lt;TDefaultDocument&amp;gt; Find(IMongoQuery query)&lt;/p&gt;

&lt;p&gt;would have an asynchronous equivalent:&lt;/p&gt;

&lt;p&gt;public Task&amp;lt;MongoCursor&amp;lt;TDefaultDocument&amp;gt;&amp;gt; FindAsync(IMongoQuery query)&lt;/p&gt;

&lt;p&gt;The resulting task represents a token for asynchronous completion of the operation.&lt;/p&gt;

&lt;p&gt;The driver exposes lots of I/O operations, but having the most used ones (Find, FindOne, Insert...) implemented first that way would go a long way.&lt;/p&gt;</description>
                <environment></environment>
        <key id="14042">CSHARP-138</key>
            <summary>Add asynchronous APIs</summary>
                <type id="2" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14711&amp;avatarType=issuetype">New Feature</type>
                                            <priority id="2" iconUrl="https://jira.mongodb.org/images/icons/priorities/critical.svg">Critical - P2</priority>
                        <status id="6" iconUrl="https://jira.mongodb.org/images/icons/statuses/closed.png" description="The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.">Closed</status>
                    <statusCategory id="3" key="done" colorName="success"/>
                                    <resolution id="3">Duplicate</resolution>
                                        <assignee username="craig.wilson@mongodb.com">Craig Wilson</assignee>
                                    <reporter username="flavien">Flavien</reporter>
                        <labels>
                    </labels>
                <created>Wed, 22 Dec 2010 00:49:25 +0000</created>
                <updated>Mon, 9 Feb 2015 03:07:30 +0000</updated>
                            <resolved>Wed, 3 Sep 2014 19:49:38 +0000</resolved>
                                                    <fixVersion>2.0</fixVersion>
                                                        <votes>77</votes>
                                    <watches>66</watches>
                                                                                                                <comments>
                            <comment id="824532" author="craiggwilson" created="Mon, 9 Feb 2015 03:07:30 +0000"  >&lt;p&gt;Yaron, &lt;/p&gt;

&lt;p&gt;Yes, this ticket will be taken care of in 2.0.0. Currently, it&apos;s in beta2 form on &lt;a href=&quot;https://www.nuget.org/packages/mongocsharpdriver/2.0.0-beta2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;nuget&lt;/a&gt; or on &lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/releases/tag/v2.0.0-beta2&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;github&lt;/a&gt;. We&apos;d love for you to use it and provide some feedback.&lt;/p&gt;

&lt;p&gt;Craig&lt;/p&gt;</comment>
                            <comment id="824453" author="yaronlevi" created="Sun, 8 Feb 2015 21:39:22 +0000"  >&lt;p&gt;Are there any updates regarding the release date of AWAIT/ASYNC support for the C# driver ?&lt;br/&gt;
It is a really showstopper for us to use mongo in production.&lt;/p&gt;</comment>
                            <comment id="710931" author="craiggwilson" created="Wed, 3 Sep 2014 19:49:38 +0000"  >&lt;p&gt;We are closing this as it is slightly redundant. It fits in with a number of other tickets. This is absolutely a required part of our 2.0 release and we&apos;ve built in async from the low level core and are building it into a new higher level API. It uses Tasks so that async await is possible.  Feel free to keep commenting here if you&apos;d like.&lt;/p&gt;</comment>
                            <comment id="704831" author="craiggwilson" created="Tue, 26 Aug 2014 22:41:38 +0000"  >&lt;p&gt;Yes, we have discussed this and will be adding ConfigureAwait everywhere (I think) internally as well. I&apos;ll open a ticket to ensure we don&apos;t forget. Thanks Ben.&lt;/p&gt;</comment>
                            <comment id="704829" author="andrebires" created="Tue, 26 Aug 2014 22:41:15 +0000"  >&lt;p&gt;Yes, its essential to avoid deadlocks when using it with WPF, ASP.Net and&lt;br/&gt;
other applications with custom synchronization contexts.&lt;/p&gt;
</comment>
                            <comment id="704813" author="fsbrooke" created="Tue, 26 Aug 2014 22:29:27 +0000"  >&lt;p&gt;That makes more sense when in a UI application with a single UI thread and you have more work that doesn&apos;t require the SynchronizationContext.&lt;br/&gt;
In ASP.NET there&apos;s a managed thread pool for requests and you often want to keep the request context. &lt;br/&gt;
If there are methods that don&apos;t require that context then yeah, ConfigureAwait(false) is recommended.&lt;/p&gt;</comment>
                            <comment id="704795" author="ben.brockway@nxtera.com" created="Tue, 26 Aug 2014 22:16:02 +0000"  >&lt;p&gt;It is good to see some progress is happening on this in GitHub. I have one concern/suggestion;&lt;/p&gt;

&lt;p&gt;When doing awaits, within a library, I think we should be using ConfigureAwait(false). This is an efficiency optimisation that is not yet widely known. A few quick links;&lt;br/&gt;
&lt;a href=&quot;http://channel9.msdn.com/Series/Three-Essential-Tips-for-Async/Async-library-methods-should-consider-using-Task-ConfigureAwait-false-&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://channel9.msdn.com/Series/Three-Essential-Tips-for-Async/Async-library-methods-should-consider-using-Task-ConfigureAwait-false-&lt;/a&gt;&lt;br/&gt;
&lt;a href=&quot;http://rehansaeed.co.uk/configureawait-task-parallel-library/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://rehansaeed.co.uk/configureawait-task-parallel-library/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do you agree?&lt;/p&gt;</comment>
                            <comment id="699557" author="daniel.sinclair@nupe.com" created="Fri, 22 Aug 2014 09:41:14 +0000"  >&lt;p&gt;I hope there will be a &quot;Migrating from 1.9 to 2.0&quot; article. I already ran&lt;br/&gt;
into some custom serialization code that doesn&apos;t compile from HEAD. I&lt;br/&gt;
understand there are quite a few breaking changes in this area with 2.0&lt;br/&gt;
even if not embracing the async APIs immediately.&lt;/p&gt;






&lt;p&gt;&amp;#8211; &lt;br/&gt;
Daniel Sinclair&lt;br/&gt;
nupe.com&lt;/p&gt;

&lt;p&gt;@danieljsinclair&lt;br/&gt;
&lt;a href=&quot;http://uk.linkedin.com/in/danieljsinclair&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://uk.linkedin.com/in/danieljsinclair&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="699546" author="seif" created="Fri, 22 Aug 2014 09:26:13 +0000"  >&lt;p&gt;Judging by the fact that this ticket is now in a sprint, and the dependencies resolved, I guess it won&apos;t be long before this is implemented. Looking forward to testing it!&lt;/p&gt;</comment>
                            <comment id="699537" author="daniel.sinclair@nupe.com" created="Fri, 22 Aug 2014 09:11:13 +0000"  >&lt;p&gt;&lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;

&lt;p&gt;That&apos;s awesome - and that&apos;s been available for how many hours exactly? :-P&lt;/p&gt;


&lt;p&gt;On 22 August 2014 02:46, Andr&#233; Bires Fonseca (JIRA) &amp;lt;jira@mongodb.org&amp;gt;&lt;/p&gt;




&lt;p&gt;&amp;#8211; &lt;br/&gt;
Daniel Sinclair&lt;br/&gt;
nupe.com&lt;/p&gt;

&lt;p&gt;@danieljsinclair&lt;br/&gt;
&lt;a href=&quot;http://uk.linkedin.com/in/danieljsinclair&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://uk.linkedin.com/in/danieljsinclair&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="699232" author="andrebires" created="Fri, 22 Aug 2014 01:45:34 +0000"  >&lt;p&gt;Of if you are in Azure, you now can use the new DocumentDB database:&lt;br/&gt;
&lt;a href=&quot;http://azure.microsoft.com/en-us/services/documentdb/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://azure.microsoft.com/en-us/services/documentdb/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="699185" author="fsbrooke" created="Fri, 22 Aug 2014 00:45:07 +0000"  >&lt;p&gt;Yes I use node.js for certain other things but this is a web api that I want to use C# for. Cassandra looks okay except that I need strong consistency.&lt;/p&gt;</comment>
                            <comment id="699178" author="andrebires" created="Fri, 22 Aug 2014 00:36:55 +0000"  >&lt;p&gt;Actually I&apos;m not working with this code anymore. But it was working last time I used it, with some instabilities sometimes (the execution was hanging; I believe is something related to the connection pool that the driver implements).&lt;/p&gt;

&lt;p&gt;I was not familiar with the codebase and with the concepts of the protocol but I was able to make this almost-working async version of the driver in three days (including async LINQ). Maybe someone with more experience and time could improve it and release at least an alpha async version of the driver. Or depending of your level of desperation, you can move to Cassandra that have a very nice full-async C# driver: &lt;a href=&quot;https://github.com/datastax/csharp-driver/&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/datastax/csharp-driver/&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="699118" author="mikemcg" created="Thu, 21 Aug 2014 23:30:31 +0000"  >&lt;p&gt;^ That solution does not use IOCP. It just moves the load from the threadpool to a tiny threadpool. It&apos;ll start blocking as soon as it hits 8 concurrent commands. See &lt;a href=&quot;http://blogs.msdn.com/b/pfxteam/archive/2012/03/24/10287244.aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://blogs.msdn.com/b/pfxteam/archive/2012/03/24/10287244.aspx&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;Andre Fonseca mentioned his in-progress work, which does use IOCP (e.g. &lt;a href=&quot;https://github.com/andrebires/mongo-csharp-driver/blob/master/MongoDB.Bson/IO/BsonBuffer.cs#L713&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/andrebires/mongo-csharp-driver/blob/master/MongoDB.Bson/IO/BsonBuffer.cs#L713&lt;/a&gt;), in a comment above.&lt;/p&gt;</comment>
                            <comment id="699084" author="cse_andrew" created="Thu, 21 Aug 2014 23:04:36 +0000"  >&lt;p&gt;For what it&apos;s worth, if anybody is absolutely desperate, here&apos;s a very simple set of async wrappers that we use around the MongoDB C# API:&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://pastebin.com/cz723Dms&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://pastebin.com/cz723Dms&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are just some simple static helper methods that queue a query to a separate thread pool and return a task that completes when your query does. They&apos;re obviously a very crude hack, and they don&apos;t handle very large result (because they gather the entire result and thencollapse it into a List&amp;lt;&amp;gt;), and they&apos;re only tested for 1.8 (not the current 1.9), and they don&apos;t support RequestStart() or anything but the most common entry points we use.&lt;/p&gt;

&lt;p&gt;But despite all that, they&apos;re working well enough for us today, and they&apos;ve dramatically improved throughput on our server. To use them, just include the file in your project, and then you can do:&lt;/p&gt;

&lt;p&gt;    List&amp;lt;MyType&amp;gt; result = await someCollection.FindAsAsync&amp;lt;MyType&amp;gt;( someQuery );&lt;/p&gt;

&lt;p&gt;Be sure to call MongoAsyncHelpers.Shutdown() on exit. Hopefully this tiny contribution will help some of the people here until there&apos;s a supported and official solution.&lt;/p&gt;</comment>
                            <comment id="698343" author="tgeek" created="Thu, 21 Aug 2014 14:38:36 +0000"  >&lt;p&gt;Hi Fabien, Don&apos;t want to troll here but I literally waited 1 year for this feature and then moved my app to NodeJS. MongoDB is really cool for certain tasks and C# driver is right now the only driver which doesn&apos;t support fully async non-blocking operations. Even scala (which is a comparatively new language) has this feature.   &lt;br/&gt;
There is no way you can work with a blocking api if you&apos;re working with a high performance connected app which notifies all the connected client in near real time. &lt;/p&gt;</comment>
                            <comment id="698002" author="fsbrooke" created="Thu, 21 Aug 2014 08:47:40 +0000"  >&lt;p&gt;Do you have a rough approximation of when 2.0 is to be released? Just wondering how much work to put in an app I&apos;ve started for supporting things not included in the current version.&lt;/p&gt;</comment>
                            <comment id="661032" author="rstam" created="Wed, 16 Jul 2014 19:56:17 +0000"  >&lt;p&gt;Development has started on this feature, but the work is tied to some other tickets:&lt;/p&gt;

&lt;p&gt;1. &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1013&quot; title=&quot;Create new Core Library&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1013&quot;&gt;&lt;del&gt;CSHARP-1013&lt;/del&gt;&lt;/a&gt; Create a new Core library (which will be 100% async)&lt;br/&gt;
2. &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-974&quot; title=&quot;New High Level API&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-974&quot;&gt;&lt;del&gt;CSHARP-974&lt;/del&gt;&lt;/a&gt; New High Level API (which will add async functionality at the high level)&lt;/p&gt;

&lt;p&gt;RequestStart will not work in any async environment because RequestStart is based on thread affinity. There will be some other mechanism, the details of which are still under discussion, for the application to indicate that a series of related operations should be sent to the server over the same connection.&lt;/p&gt;</comment>
                            <comment id="660257" author="eyalpost" created="Wed, 16 Jul 2014 06:12:46 +0000"  >&lt;p&gt;So I&apos;m assuming development hasn&apos;t started on this yet, right?&lt;br/&gt;
Would be interesting to see how RequestStart  will be implemented. Any idea if this will still work?&lt;/p&gt;</comment>
                            <comment id="655907" author="rstam" created="Fri, 11 Jul 2014 13:04:54 +0000"  >&lt;p&gt;Sorry about the confusion with version numbers. The next version of the driver is 2.0, and will include async support. For a short while we were going to call the next major version 3.0 (long story), but currently the next major version is 2.0.&lt;/p&gt;

&lt;p&gt;The approach we are taking for 2.0 to support async and other improvements to the API is:&lt;/p&gt;

&lt;p&gt;1. Create a new Core library (see &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-1013&quot; title=&quot;Create new Core Library&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-1013&quot;&gt;&lt;del&gt;CSHARP-1013&lt;/del&gt;&lt;/a&gt;)&lt;br/&gt;
2. Reimplement the existing API (the legacy API) on top of the new Core libary (see &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-875&quot; title=&quot;Reimplement legacy API on top of New Core&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-875&quot;&gt;&lt;del&gt;CSHARP-875&lt;/del&gt;&lt;/a&gt;)&lt;br/&gt;
3. Introduce a new high level API (see &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-978&quot; title=&quot;Design and create new database implementation&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-978&quot;&gt;&lt;del&gt;CSHARP-978&lt;/del&gt;&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;We plan for the new Core library to be 100% async, and to implement sync versions of the high level APIs by simply blocking for the async tasks to complete. Because the granularity of the async tasks will be relatively coarse, we don&apos;t think this will cause significant overhead. This will result in less duplicate code.&lt;/p&gt;

&lt;p&gt;We do &lt;b&gt;not&lt;/b&gt; plan to add async support to the legacy API, only to the new high level API. For the new high level API the plan is to provide two versions of the high level API: a sync version and an async version (rather than one high level API with both sync and async versions of each method). We think this has two major benefits:&lt;/p&gt;

&lt;p&gt;1. You can&apos;t accidentally call sync versions of methods when writing async code (async code should be 100% async)&lt;br/&gt;
2. It cuts in half the number of methods that Intellisense must display&lt;/p&gt;</comment>
                            <comment id="655813" author="almaz" created="Fri, 11 Jul 2014 10:18:28 +0000"  >&lt;p&gt;Craig, I&apos;ve started working on implementation of this feature (&lt;a href=&quot;https://github.com/almazik/mongo-csharp-driver/tree/feature/CSHARP-138-AsyncAPI&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/almazik/mongo-csharp-driver/tree/feature/CSHARP-138-AsyncAPI&lt;/a&gt;). Can anyone from the team review the changes to ensure that my approach corresponds to your vision? I&apos;m extending existing classes/interfaces with corresponding async implementation, similarly to the way .NET libraries were extended with XxxAsync methods. It causes some level of code duplication, so I&apos;m also refactoring common code where it seems necessary.&lt;/p&gt;</comment>
                            <comment id="655778" author="seif" created="Fri, 11 Jul 2014 09:21:26 +0000"  >&lt;p&gt;Just to confirm that it is infact the 2.0 driver not the 3.0 driver? This ticket says 2.0 but Craig&apos;s last comment says 3.0.&lt;/p&gt;

&lt;p&gt;Looking forward to this happening.&lt;/p&gt;</comment>
                            <comment id="542630" author="craiggwilson" created="Wed, 9 Apr 2014 18:38:29 +0000"  >&lt;p&gt;Driver. Should be this year, yes.&lt;/p&gt;</comment>
                            <comment id="542549" author="snielsson" created="Wed, 9 Apr 2014 17:47:05 +0000"  >&lt;p&gt;ok thanks. Is that 3.0 of the server or 3.0 of the c# driver?&lt;br/&gt;
And much more important, when is 3.0 planned for release? is it in 2014 ?&lt;/p&gt;

&lt;p&gt;/Stig&lt;/p&gt;</comment>
                            <comment id="542056" author="craiggwilson" created="Wed, 9 Apr 2014 12:22:35 +0000"  >&lt;p&gt;It&apos;s scheduled for our next major version (3.0).&lt;/p&gt;</comment>
                            <comment id="541827" author="snielsson" created="Wed, 9 Apr 2014 06:50:35 +0000"  >&lt;p&gt;Hi, I just saw that v. 1.9 of the driver was released on the 3rd of April but apparently without async support?&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/mongodb/mongo-csharp-driver/blob/master/Release%20Notes/Release%20Notes%20v1.9.md&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/mongodb/mongo-csharp-driver/blob/master/Release%20Notes/Release%20Notes%20v1.9.md&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Can we get an update about when async is expected to be supported ?&lt;/p&gt;

&lt;p&gt;/Stig&lt;/p&gt;


</comment>
                            <comment id="518749" author="andrebires" created="Tue, 18 Mar 2014 21:12:37 +0000"  >&lt;p&gt;Since my company is awaiting for this feature and I thought that should be a good way to learn better how the protocol works, I&apos;ve started today to try to make a async version of the driver. I began from the MongoConnection class, changing the Read and Write Networkstream methods to the async version and propagating the changes by the code. Besides that, I&apos;ve made some changes in the way the connection locks (using SemaphoreSlim instead of a lock), but the behavior is still a lot buggy. &lt;/p&gt;

&lt;p&gt;For LINQ support, I&apos;ve created async interfaces (IEnumeratorAsync and IEnumerableAsync) and implemented the FirstOrDefaultAsync method for this interface (is the only one true async LINQ method). I&apos;ll try to implement the others soon.&lt;/p&gt;

&lt;p&gt;PS: The tests are not working yet. &lt;/p&gt;

&lt;p&gt;EDIT:&lt;/p&gt;

&lt;p&gt;I&apos;ve included the async LINQ methods and implemented the basic support for most of operations (ToListAsync, FirstOrDefaultAsync, FirstAsync, ToDictionaryAsync, and so). I made an adaption from the EF6.1 async implementation to make this possible.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://github.com/andrebires/mongo-csharp-driver&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/andrebires/mongo-csharp-driver&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="487007" author="itadapter" created="Fri, 24 Jan 2014 02:07:12 +0000"  >&lt;p&gt;People, the absence of ASYNC support in MongoDB .NET driver really kills the deal for us.&lt;br/&gt;
I could care less if it is &quot;an old .net&quot; API vs Tasks only +- await support. We just need to make remote calls into Mongo in async fashion.&lt;br/&gt;
What is the status as of today?(2014 Jan 23)?  &lt;br/&gt;
Mongo is a great product, but always-blocking calls really kill it in CLR solution (we do not use much of .NET stack).&lt;/p&gt;

&lt;p&gt;Our case:&lt;br/&gt;
 I am at the point now where I am planning to either abdicate from the Mongo solution altogether or start implementing my own primitive socket-based &quot;driver&quot; as I really need it to support fetching BSON docs by PK and writing by PK, also 1-2 primitive queries on indexed column. &lt;/p&gt;</comment>
                            <comment id="454678" author="attilah" created="Mon, 11 Nov 2013 21:46:53 +0000"  >&lt;p&gt;Hi Craig!&lt;/p&gt;

&lt;p&gt;Thanks for the update &lt;img class=&quot;emoticon&quot; src=&quot;https://jira.mongodb.org/images/icons/emoticons/smile.png&quot; height=&quot;16&quot; width=&quot;16&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt; I know it&apos;s not easy to rewrite something to fully support async and not just behave like one that supports!&lt;/p&gt;

&lt;p&gt;Keep up the good work!&lt;/p&gt;</comment>
                            <comment id="454020" author="craiggwilson" created="Sat, 9 Nov 2013 13:14:38 +0000"  >&lt;p&gt;Hi Attila,&lt;br/&gt;
  We&apos;ve been working on the 2.0 version of the code. This feature will be requirement for us to release our next major version; as in, we won&apos;t release 2.0 without async support.  The server is in the midst of doing some refactoring of how connections are handled and rushing this could cause some significant rework down the road.  Therefore, we&apos;re taking our time to get this right.&lt;/p&gt;

&lt;p&gt;We don&apos;t have an ETA yet, but it will likely be Q1 of 2014.  In addition, async will only be supported for .NET 4.5.&lt;/p&gt;</comment>
                            <comment id="454012" author="attilah" created="Sat, 9 Nov 2013 10:26:47 +0000"  >&lt;p&gt;Any update on this? October passed, November is almost in the middle and as I&apos;ve checked out the v2.0 driver branch saw no sign of any &quot;async&quot; or &quot;await&quot; in the code.&lt;/p&gt;

&lt;p&gt;Thanks,&lt;br/&gt;
Attila&lt;/p&gt;</comment>
                            <comment id="446074" author="i3arnon" created="Thu, 24 Oct 2013 15:29:43 +0000"  >&lt;p&gt;I would like to join in...&lt;br/&gt;
All products at my company rely on the async await pattern so we would want to know if and when such ability will be available.&lt;br/&gt;
also, i would suggest also adding it to Linq to Mongo as extension methods. for example:&lt;/p&gt;

&lt;p&gt;public static async Task&amp;lt;int&amp;gt; SumAsync&amp;lt;TSource&amp;gt;(this IQueryable&amp;lt;TSource&amp;gt; source);&lt;/p&gt;

&lt;p&gt;Thanks,&lt;/p&gt;</comment>
                            <comment id="429446" author="hatch" created="Sat, 21 Sep 2013 22:36:10 +0000"  >&lt;p&gt;Agree with above. This is critical for adoption of MongoDB by my team. This is important for any high-performance database, but especially for MongoDB given that so many operations involve multiple queries to the database that might have traditionally been performed in a single request.&lt;/p&gt;</comment>
                            <comment id="418636" author="tanglebones" created="Thu, 5 Sep 2013 16:53:40 +0000"  >&lt;p&gt;My team wants the task based approach, as we are moving towards async/await for everything and building on top of HttpListerner GetContextAsync. The sooner we can get this, the better.&lt;/p&gt;</comment>
                            <comment id="387374" author="tgeek" created="Tue, 23 Jul 2013 22:24:25 +0000"  >&lt;p&gt;Hi Craig, &lt;br/&gt;
I&apos;m glad to hear that its coming in Nov. &lt;/p&gt;

&lt;p&gt;I&apos;ve MongoDB behind a web app which has about 300 million hits/month. Each visit generate 6-7 mongodb read and writes. The app is on Linux, means we don&apos;t have IIS. NGINX and Apache are not the option with Mono for me. To avoid all the concurrency problems I modeled the app in a single threaded way, means app runs in a single thread. (All new web frameworks .NET WebApi, Nancy, ServiceStack provides async + in-app hosting facility, where you don&apos;t need IIS do deploy the app)&lt;/p&gt;

&lt;p&gt;With mongodb I can&apos;t scale that app to more than 20-30 requests/second. I moved the app to NodeJS and its amazingly fast. Because of all the non-blocking IO. &lt;/p&gt;

&lt;p&gt;Just because C# doesn&apos;t have Async driver I can&apos;t scale my app beyond 20-30 requets/second with mono. I had to move to NodeJS. I can easily scale upto couple of thousands requests/second on NodeJS. &lt;/p&gt;

&lt;p&gt;The big obstacle with C# is the blocking calls to mongo. The thread gets freezed for 30-40 ms for each round-trip to mongo and can&apos;t do anything. &lt;/p&gt;

&lt;p&gt;I guess its a very common use case for todays&apos; web apps. Asp.NET signalR, websockets and all the katana stuff, non-blocking IO isn&apos;t only a luxury but a very fundamental requirement.   &lt;/p&gt;</comment>
                            <comment id="378787" author="craiggwilson" created="Thu, 11 Jul 2013 12:15:12 +0000"  >&lt;p&gt;We are currently working on it.  October/November is likely the earliest for 2.0 as we are rewriting the portions of the driver that need to be async friendly.&lt;/p&gt;

&lt;p&gt;Would you mind elaborating on what you expect async is going to provide you and why you can&apos;t use it today with blocking calls?&lt;/p&gt;</comment>
                            <comment id="378717" author="tgeek" created="Thu, 11 Jul 2013 08:58:15 +0000"  >&lt;p&gt;I&apos;ve been waiting for async driver for long because its a show stopper for me to use blocking calls in production. I&apos;m excited that finally its been taking care in v2.0. &lt;/p&gt;

&lt;p&gt;Any ideas when we can expect a first alpha release ? &lt;/p&gt;</comment>
                            <comment id="311458" author="ctaggart" created="Thu, 11 Apr 2013 21:06:31 +0000"  >&lt;p&gt;Just supporting the new Task based async makes sense. Really looking forward to trying it out.&lt;/p&gt;</comment>
                            <comment id="294588" author="flavien" created="Thu, 21 Mar 2013 04:03:15 +0000"  >&lt;p&gt;Wow, that&apos;s great news, thanks!&lt;/p&gt;</comment>
                            <comment id="289508" author="craiggwilson" created="Thu, 14 Mar 2013 20:32:35 +0000"  >&lt;p&gt;Yes, this is going to be one of the most important additions to the 2.0 driver.  We have not yet decided on which version(s) to support. We are leaning towards just support the Task based version as we will be upgrading to .NET 4 with the 2.0 release anyways.&lt;/p&gt;</comment>
                            <comment id="289482" author="flavien" created="Thu, 14 Mar 2013 20:18:42 +0000"  >&lt;p&gt;Is that going to be addressed in 2.0? Just as pointed out above, you don&apos;t have to target .NET 4.0 to address this, just expose BeginXXX/EndXXX methods. It&apos;s easy to then turns them into a Task usable with await if someone needs to, using Task.Factory.FromAsync.&lt;/p&gt;</comment>
                            <comment id="256001" author="nerophon" created="Fri, 1 Feb 2013 21:39:43 +0000"  >&lt;p&gt;Having async in the C# would make an enormous difference for us. Please add it! As a mono user, I&apos;d definitely prefer use of the backwards-compatible pattern.&lt;/p&gt;</comment>
                            <comment id="241004" author="newdude" created="Wed, 16 Jan 2013 01:27:19 +0000"  >&lt;p&gt;I am also in dire need of this feature. Would love to see it soon... Almost every other language has an async library except for .NET.&lt;/p&gt;</comment>
                            <comment id="204351" author="pbi@patternbuilders.com" created="Sun, 2 Dec 2012 03:48:04 +0000"  >&lt;p&gt;This functionality would be very useful for us as well. &lt;/p&gt;

&lt;p&gt;Does the availability of the Async Targeting Pack &lt;a href=&quot;http://www.microsoft.com/en-us/download/details.aspx?id=29576&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://www.microsoft.com/en-us/download/details.aspx?id=29576&lt;/a&gt; which adds support for the Async Keyword on .NET 4.0 change the scheduling concerns mentioned in Robert&apos;s earlier comment? Or does the fact that the targeting pack requires Visual Studio 11 still make scheduling this problematic?&lt;/p&gt;</comment>
                            <comment id="164671" author="mikemcg" created="Fri, 14 Sep 2012 23:03:46 +0000"  >&lt;p&gt;(Er, the event argument in that example is just an extension of System.ComponentModel.AsyncCompletedEventArgs that adds an Argument property of type Tuple&amp;lt;object, int&amp;gt;. Item1 holds userState, possibly needed to determine if the handler delegate is appropriate for the invocation, and Item2 the result computed from the given input.)&lt;/p&gt;</comment>
                            <comment id="164668" author="mikemcg" created="Fri, 14 Sep 2012 22:52:16 +0000"  >&lt;p&gt;Great news!&lt;/p&gt;

&lt;p&gt;If it&apos;s just a matter of deciding the approach, consider the following. We&apos;ve got three established patterns for asynchronous APIs in .NET: event-based asynchronous pattern (EAP), asynchronous programming model (APM), and Task-based asyncronous pattern (TAP):&lt;/p&gt;

&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;APM. Pros: easy to consume, good for blocking and polling. Cons: no progress updates or cancellation, requires implementation of IAsyncResult.&lt;/li&gt;
	&lt;li&gt;EAP. Pros: recommended for pre-.NET 4.0, supports progress updates and cancellation. Cons: more complex consumption which relies on caller-provided invocation tokens (`object userState`).&lt;/li&gt;
	&lt;li&gt;TAP: Pros: very easy to consume, supporting progress and cancellation. Can be used with C# 5.0 async/await. Cons: Requires .NET 4.0.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;The nice thing about the TPL is that you can easily wrap the APM pattern with TaskFactory.FromAsync. It&apos;s so trivial you could leave that to the application, and simply deliver an APM implementation.  On the other hand, using TaskCompletionSource to wrap EAP is straightforward as well. E.g. (doesn&apos;t demonstrate progress):&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; tcs = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; TaskCompletionSource&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&amp;gt;();&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; service = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; LowLevelEventService();&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    service.OperationCompleted += (sender, a) =&amp;gt; {&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; (a.Error != &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;) tcs.SetException(a.Error);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; (a.Cancelled) tcs.SetCanceled(); &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; tcs.SetResult(a.Argument.Item2);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    };&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;var&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; state = &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;();&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    service.OperationAsync(&lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&quot;argument&quot;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;, state);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    &lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;//service.OperationAsyncCancel(state);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    Console.WriteLine(tcs.Task.Result);&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: #008200; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;//await tcs.Task;&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;

&lt;p&gt;In the past, I&apos;ve actually implemented all three simultaneously, where both the APM and TAP implementations are based on the EAP implementation. This approach could be used without the TAP implementation in order to remain compatible with .NET 2.0.&lt;/p&gt;

&lt;p&gt;Optional: To prevent both EAP and APM from cluttering IntelliSense, you could hide one or the other. Although this pre-.NET 4.0 article &amp;lt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms228966.aspx&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://msdn.microsoft.com/en-us/library/ms228966.aspx&lt;/a&gt;&amp;gt; recommends hiding the APM implementation, you might want to hide EAP so it&apos;s easier to wrap with TaskFactory.FromAsync.&lt;/p&gt;</comment>
                            <comment id="164652" author="rstam" created="Fri, 14 Sep 2012 21:52:47 +0000"  >&lt;p&gt;I believe the only reason it is marked as minor is because it was marked as minor by the original creator of the JIRA issue and no one has touched it since.&lt;/p&gt;

&lt;p&gt;I&apos;m fine with changing this to major and will do so.&lt;/p&gt;

&lt;p&gt;The scheduling of this depends a lot on whether we feel that async support should use the latest recommended async patterns from .NET 4.5 and C# 5. It seems a shame to implement a version of async support that uses the obsolete .NET 3.5 async patterns when those patterns have already been replaced with better ones.&lt;/p&gt;

&lt;p&gt;And the problem with basing our async implementation on .NET 4.5 and C# 5 is that raising the minimum .NET requirement for using the driver all the way to .NET 4.5 might be too cutting edge for some of our users (and would almost certainly cause problems for our Mono users).&lt;/p&gt;

&lt;p&gt;Therefore the scheduling is uncertain, even though the merits of supporting async are not in question.&lt;/p&gt;
</comment>
                            <comment id="164647" author="mickdelaney" created="Fri, 14 Sep 2012 21:33:46 +0000"  >&lt;p&gt;This is a big missing piece for mongo with .net&lt;br/&gt;
An async driver for web app&apos;s is critical for scale. &lt;/p&gt;

&lt;p&gt;can we at least here a solid reason why this is still perceived as &apos;minor&apos; ?&lt;/p&gt;</comment>
                            <comment id="160849" author="mikemcg" created="Wed, 5 Sep 2012 21:05:55 +0000"  >&lt;p&gt;(Cross-posted to &lt;a href=&quot;https://jira.mongodb.org/browse/CSHARP-544&quot; title=&quot;Asynchronous I/O while inserting documents&quot; class=&quot;issue-link&quot; data-issue-key=&quot;CSHARP-544&quot;&gt;&lt;del&gt;CSHARP-544&lt;/del&gt;&lt;/a&gt;.)&lt;/p&gt;

&lt;p&gt;To keep this discussion alive, I&apos;d like to point to this comparison of async/IOCP-based code vs blocking code: &lt;a href=&quot;http://stackoverflow.com/a/6230846/29805&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;http://stackoverflow.com/a/6230846/29805&lt;/a&gt; . (Just substitute a MongoCollection.Find call for Thread.Sleep.)&lt;/p&gt;

&lt;p&gt;Without IOCP, ASP.NET can only handle 9 simultaneous requests at once this benchmark. With IOCP, ASP.NET can start asynchronously processing all requests almost simultaneously, leading to a 97% decrease in overall execution time!&lt;/p&gt;

&lt;p&gt;Leveraging IOCP in the C# driver is absolutely critical for high-performance .NET applications. Adding this would be a quick win for performance.&lt;/p&gt;</comment>
                            <comment id="156056" author="kamaradclimber" created="Thu, 23 Aug 2012 13:33:47 +0000"  >&lt;p&gt;It would very useful for me either.&lt;/p&gt;</comment>
                            <comment id="133612" author="mattdot" created="Sun, 17 Jun 2012 01:11:56 +0000"  >&lt;p&gt;I agree that this should be a much higher priority. For me this is pretty much a deal breaker for mongo in production until it&apos;s available. I like mongo a lot, but I feel like I&apos;d be giving up too much with ASP.NET calling a synchronous api.  That&apos;s just a recipe for not scaling. &lt;/p&gt;

&lt;p&gt;I haven&apos;t looked how the driver is implemented but if it&apos;s using deferred execution, then db.Find(...).AsAsync() would be a nice way to support the Async calls on all the methods.&lt;/p&gt;

&lt;p&gt;By the way, this is listed as a &quot;minor&quot; issue with an easy workaround?  What&apos;s the easy workaround to get non-blocking io with the mongo driver?  This should be classified as major.&lt;/p&gt;</comment>
                            <comment id="120946" author="sn" created="Fri, 18 May 2012 14:11:54 +0000"  >&lt;p&gt;TPL is not required for making an async API, so support for async need not wait for you to upgrade to C# 4.0. I too would very very much like to see async support soon in the C# driver.  &lt;/p&gt;</comment>
                            <comment id="120924" author="craiggwilson" created="Fri, 18 May 2012 13:02:22 +0000"  >&lt;p&gt;As we don&apos;t support native .NET 4.0, we don&apos;t have the bits to work with the TPL.  Since we are planning to add formal support for .NET 4.0 in version 2.0 of the driver, this would be an area we would look into and see if there is any benefit to adding async support to the driver.&lt;/p&gt;</comment>
                            <comment id="120855" author="mikemcg" created="Fri, 18 May 2012 06:45:52 +0000"  >&lt;p&gt;Haven&apos;t dug too deep, but since MongoCursor exposes a fluent interface, one approach to providing asynchronous execution would be for MongoCursor&amp;lt;T&amp;gt; to provide a method StartToList which returns something like Task&amp;lt;IList&amp;lt;T&amp;gt;&amp;gt;. (The implementation would start a Task to eagerly do the processing from MongoCursorEnumerator, and pass the parameters to a new MongoConnection method StartReceiveMessage. This returns a Task&amp;lt;MongoReplyMessage&amp;gt; and would ultimately delegate to the new BsonBuffer.StartLoadFrom, which could use TaskFactory.FromAsync to wrap Stream.Begin/EndRead.)&lt;/p&gt;

&lt;p&gt;Such a &lt;b&gt;critical&lt;/b&gt; performance feature should be more highly prioritized, and at least should be scheduled. Once C# 5.0 is released, I imagine .NET users will be much more vocal about their desire for it.&lt;/p&gt;</comment>
                            <comment id="99020" author="mcatanzariti" created="Thu, 15 Mar 2012 04:19:02 +0000"  >&lt;p&gt;The main problem is that &lt;br/&gt;
public MongoCursor&amp;lt;TDefaultDocument&amp;gt; Find(IMongoQuery query)&lt;br/&gt;
does not actually wait for the network.&lt;/p&gt;

&lt;p&gt;It&apos;s rather the first invocation to MongoCursorEnumerator.MoveNext (when a MongoCursor is enumerated in a foreach or a ToList) that actually connects to the database and sends a OP_QUERY message.&lt;/p&gt;

&lt;p&gt;Moreover subsequent calls to MongoCursorEnumerator.MoveNext could lead to send a OP_GETMORE command to the server if the first OP_QUERY was not enough to fetch the whole document batch from the server.&lt;/p&gt;

&lt;p&gt;It means that &lt;br/&gt;
public Task&amp;lt;MongoCursor&amp;lt;TDefaultDocument&amp;gt;&amp;gt; FindAsync(IMongoQuery query)&lt;br/&gt;
would not really help for it could not really be asynchronous&lt;/p&gt;
</comment>
                            <comment id="46399" author="manishtpatel" created="Thu, 4 Aug 2011 16:46:22 +0000"  >&lt;p&gt;Agree with Flavien, once async is done, using it in sync fashion do not need any work at all.&lt;br/&gt;
How exactly async io should be done is demonstrated in booksleeve project for redis. It does not even need much code if done right way.  It should be done using io completion port if need benefits of async.&lt;/p&gt;</comment>
                            <comment id="44451" author="flavien" created="Tue, 26 Jul 2011 09:53:41 +0000"  >&lt;p&gt;Aristarkh: I agree with you, wrapping synchronous operations in thread pool thread doesn&apos;t fit the bill, what we need is that at the lowest level, socket operations use the asynchronous versions (BeginReadByte/EndReadByte instead of ReadByte). That would ensure true asynchrony.&lt;/p&gt;

&lt;p&gt;I don&apos;t agree that &quot;it would require duplicating a fair amount of existing I/O code to cover the asynchronous case&quot;. Asynchronous APIs cannot be implemented using synchonous APIs, however implementing synchronous APIs using asynchronous APIs is trivial. You don&apos;t need to duplicate code, having the asynchronous version only is enough: reimplemeting the synchronous version using the asynchronous one is just a few lines of code. And synchronous IO is evil anyway, and in an ideal world should not even be exposed.&lt;/p&gt;</comment>
                            <comment id="34965" author="onyxmaster" created="Sat, 28 May 2011 10:57:28 +0000"  >&lt;p&gt;I would like to note that creating asynchronous code by delegating fragments of work to worker thread pool would likely only harm the performance, unless you mostly perform lengthy operations. I believe that using MongoDB from an ASP.NET and/or WCF server is the common pattern, and in this case, using thread pool threads for database calls would only increase load on garbage collector due to need to set up and tear down additional state. Unless you want split-parallel execution to decrease latency, server applications should not use CPU asynchronicity (we learned it the hard way here). Even if you&apos;re reducing latency, the split-parallel execution might actually make latency worse when server approaches its capacity. Of course, if asycnhronicity is performed at the I/O level (socket IOCP), then it would have its benefits. But, implementing I/O-level asynchronicity ain&apos;t that easy, because it would require duplicating a fair amount of existing I/O code to cover the asynchronous case.&lt;br/&gt;
Resume: &lt;br/&gt;
client case + any asynchronicity = will do since you&apos;re mostly worried about latency&lt;br/&gt;
server case + CPU asynchronicity = usually bad, unless you&apos;re reducing latency (which requires much preplanning)&lt;br/&gt;
server case + I/O asynchronicity = fine and has very little overhead, but might be hard to implement&lt;/p&gt;</comment>
                            <comment id="29563" author="xen" created="Mon, 25 Apr 2011 12:31:40 +0000"  >&lt;p&gt;As I ran into the issue, here is an auto-generated wrapper around MongoCollection and MongoCollection&amp;lt;T&amp;gt;.&lt;br/&gt;
It is not really tested yet, but generated code looks ok.&lt;br/&gt;
Feel free to use/integrate.&lt;/p&gt;

&lt;p&gt;If you want source of the template script, I can provide it as well.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10011">
                    <name>Depends</name>
                                            <outwardlinks description="depends on">
                                        <issuelink>
            <issuekey id="154989">CSHARP-1051</issuekey>
        </issuelink>
                            </outwardlinks>
                                                        </issuelinktype>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="112493">CSHARP-914</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="47023">CSHARP-544</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                            <attachment id="11748" name="MongoAsync.cs" size="31989" author="xen" created="Mon, 25 Apr 2011 12:31:40 +0000"/>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                                                                                                                                                                                        <customfield id="customfield_10011" key="com.atlassian.jira.plugin.system.customfieldtypes:radiobuttons">
                        <customfieldname>Backwards Compatibility</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="10011"><![CDATA[Minor Change]]></customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                    <customfield id="customfield_10857" key="com.pyxis.greenhopper.jira:gh-epic-link">
                        <customfieldname>Epic Link</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>CSHARP-974</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hrf9wv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1469</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10557" key="com.pyxis.greenhopper.jira:gh-sprint">
                        <customfieldname>Sprint</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue id="261">C# Sprint 7</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            </customfields>
    </item>
</channel>
</rss>