Is AsQueryable method departed in new Mongodb C# driver 2.0rc?

前端 未结 3 1434
小鲜肉
小鲜肉 2021-02-12 10:49

First of all I\'m new to MongoDb. In MongoDb C# driver 1.9.x, i can take collections as queryable with AsQueryable method like this.

        var db = client.Get         


        
3条回答
  •  太阳男子
    2021-02-12 11:42

    19 October update:

    MongoDB 2.1 driver is out https://github.com/mongodb/mongo-csharp-driver/releases/tag/v2.1.0

    It supports LINQ:

    LINQ

    CSHARP-935 LINQ support has been rewritten and now targets the aggregation framework. It is a more natural translation and enables many features of LINQ that were previously not able to be translated.

    Simply use the new AsQueryable method to work with LINQ.

    18 September update:

    MongoDB 2.1 driver RC should support it. See https://jira.mongodb.org/browse/CSHARP-935

    Finally 2.1 rc came out. Great work!

    Old answer:

    No, AsQueryable is unsupported: https://jira.mongodb.org/browse/CSHARP-935

    Type: Epic Status:OPEN Priority: Major - P3 Resolution: Unresolved

    And from the hourse's mouth: Craig Wilson on the google forum

    Yes, there is currently no AsQueryable on the new api. You can track this feature here (https://jira.mongodb.org/browse/CSHARP-935). We simply didn't have enough time to get it completed and tested thoroughly. It is scheduled for 2.1 and is a priority for us. Until then, we have integrated expression tree functionality into the Find and Aggregate methods (and some of the write methods for filtering) such that you may not need a full LINQ implementation. For instance, see the sample test class here as an example: https://github.com/mongodb/mongo-csharp-driver/blob/master/src/MongoDB.Driver.Tests/Samples/AggregationSample.cs#L77

提交回复
热议问题