Details

    • Type: New Feature New Feature
    • Status: Open Open
    • Priority: Critical - P2 Critical - P2
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 3.0
    • Component/s: None
    • Labels:
      None
    • Backward Breaking:
      Rarely
    • # Replies:
      37
    • Last comment by Customer:
      true

      Description

      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.

      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<T>.
      For exemple,

      public MongoCursor<TDefaultDocument> Find(IMongoQuery query)

      would have an asynchronous equivalent:

      public Task<MongoCursor<TDefaultDocument>> FindAsync(IMongoQuery query)

      The resulting task represents a token for asynchronous completion of the operation.

      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.

      1. MongoAsync.cs
        31 kB
        Virgile Bello

        Issue Links

          Activity

          Hide
          André Bires Fonseca
          added a comment - - edited

          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'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've made some changes in the way the connection locks (using SemaphoreSlim instead of a lock), but the behavior is still a lot buggy.

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

          PS: The tests are not working yet.

          EDIT:

          I'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.

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

          Show
          André Bires Fonseca
          added a comment - - edited 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'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've made some changes in the way the connection locks (using SemaphoreSlim instead of a lock), but the behavior is still a lot buggy. For LINQ support, I've created async interfaces (IEnumeratorAsync and IEnumerableAsync) and implemented the FirstOrDefaultAsync method for this interface (is the only one true async LINQ method). I'll try to implement the others soon. PS: The tests are not working yet. EDIT: I'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. https://github.com/andrebires/mongo-csharp-driver
          Hide
          Stig Nielsson
          added a comment -

          Hi, I just saw that v. 1.9 of the driver was released on the 3rd of April but apparently without async support?

          https://github.com/mongodb/mongo-csharp-driver/blob/master/Release%20Notes/Release%20Notes%20v1.9.md

          Can we get an update about when async is expected to be supported ?

          /Stig

          Show
          Stig Nielsson
          added a comment - Hi, I just saw that v. 1.9 of the driver was released on the 3rd of April but apparently without async support? https://github.com/mongodb/mongo-csharp-driver/blob/master/Release%20Notes/Release%20Notes%20v1.9.md Can we get an update about when async is expected to be supported ? /Stig
          Hide
          Craig Wilson
          added a comment -

          It's scheduled for our next major version (3.0).

          Show
          Craig Wilson
          added a comment - It's scheduled for our next major version (3.0).
          Hide
          Stig Nielsson
          added a comment -

          ok thanks. Is that 3.0 of the server or 3.0 of the c# driver?
          And much more important, when is 3.0 planned for release? is it in 2014 ?

          /Stig

          Show
          Stig Nielsson
          added a comment - ok thanks. Is that 3.0 of the server or 3.0 of the c# driver? And much more important, when is 3.0 planned for release? is it in 2014 ? /Stig
          Hide
          Craig Wilson
          added a comment -

          Driver. Should be this year, yes.

          Show
          Craig Wilson
          added a comment - Driver. Should be this year, yes.

            Dates

            • Created:
              Updated:
              Days since reply:
              1 week, 6 days ago
              Date of 1st Reply: