Azure-cosmos-dotnet-v2: Linq implementation generates wrong query for an ORDER BY following a SELECT

Created on 15 Apr 2017  路  8Comments  路  Source: Azure/azure-cosmos-dotnet-v2

There appears to be a bug in the Linq implementation when generating a query containing an ORDER BY following a SELECT.

class Container<T>
{
    public System.Guid id { get; set; }
    public string Key { get; set; }
    public T Content { get; set; }
}

public class Content
{
    public string Version { get; set; }
}

var content = client.CreateDocumentQuery<Container<Content>>(collection.DocumentsLink)
    .Where(container => container.Key == "MyKey")
    .Select(container => container.Content)
    .OrderBy(content => content.Version);

This generates the following query, returning zero results.
SELECT VALUE root["Content"] FROM root WHERE (root["Key"] = "MyKey") ORDER BY root["Version"] ASC

The following query returns results as expected.
SELECT VALUE root["Content"] FROM root WHERE (root["Key"] = "MyKey") ORDER BY root["Content"]["Version"] ASC

investigating

Most helpful comment

Any updates on this?

All 8 comments

It may be related to issue #208

It repros with 1.17.0 version as well.

Any updates on this?

Bug persists also in 1.7.1! Any plan to fix this in future versions?

Also having this issue. Any update? I'm using core 1.8.1.

Still broken in Microsoft.Azure.DocumentDB.Core v1.9.1

@bchong95 please look into this.

I believe this has been fixed in 2.1.3 release. Please reopen if it's still affecting any scenarios.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Frankwayne picture Frankwayne  路  3Comments

Yonisha picture Yonisha  路  5Comments

Prophasi picture Prophasi  路  6Comments

ChristopherHaws picture ChristopherHaws  路  4Comments

eiriktsarpalis picture eiriktsarpalis  路  5Comments