Elfocrash / Cosmonaut

🌐 A supercharged Azure CosmosDB .NET SDK with ORM support
https://cosmonaut.readthedocs.io
MIT License
341 stars 44 forks source link

Continuation token does not work if first page contains all null in orderby field #114

Open irriss opened 5 years ago

irriss commented 5 years ago

Let say I am excecuting this query

SELECT VALUE t.startDate FROM Items t ORDER BY t.startDate ASC

And it returns this result: (please notice - there are 8 records with null)

[
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    null,
    "1994-06-30T00:00:00Z",
    "1998-03-31T00:00:00Z",
    "1998-12-31T00:00:00Z",
    "1999-03-31T00:00:00Z",
    "1999-07-11T00:00:00Z",
    "2000-01-31T00:00:00Z",
    "2003-03-07T00:00:00Z",
    "2004-06-22T00:00:00Z",
    "2005-09-30T00:00:00Z",
    "2005-10-19T00:00:00Z",
    "2006-02-28T00:00:00Z",
    "2006-08-01T00:00:00Z"
]

If I use Cosmonaut.Extensions.PaginationExtensions.WithPagination<T>(this IQueryable<T> queryable, string continuationToken, int pageSize); and pass pageSize such that first page will contain only null in the ORDER BY field, let say pageSize = 7, then requesting second page with continuation token will return me only 1 record and no more pages.

If I pass pageSize bigger than 8 it will return all records in following pages.

I am not sure whether it's a bug in Comsos Db, Cosmos Db SDK or Cosmonaut.

Elfocrash commented 5 years ago

Hello @irriss.

Can you please provide a code snippet of how you are trying to do that so I can debug locally?

Thanks