Sieve icon indicating copy to clipboard operation
Sieve copied to clipboard

Sort not working on Cosmos DB

Open carlesUdG opened this issue 4 years ago • 6 comments

Hi Sieve,

I've found what I think is a new issue using the Sieve with Cosmos DB. When sorting, Sieve creates a query like the following:

SELECT VALUE root FROM root ORDER BY ((root[\"vulnId\"] = null) ? null : root[\"vulnId\"]) ASC OFFSET 0 LIMIT 100.

As you can see, the ORDER BY is using a derivative of a value, instead of a property of a document, as Cosmos requires, here is the doc: https://docs.microsoft.com/en-us/azure/cosmos-db/sql-query-order-by#remarks. Also here there is an example of this Cosmos limitation: https://stackoverflow.com/questions/56041767/cosmos-db-order-by-on-computed-field.

As a result, every time I sort, an error 500 is thrown by the cosmos library. Is there any way to support this Cosmos DB limitation?

Thank you!

carlesUdG avatar Jan 18 '21 10:01 carlesUdG

Hi team,

I have the same error, any estimation about when it will be fixed?

Thanks!

p3r1c0 avatar Jan 19 '21 09:01 p3r1c0

Same here. I've been one week trying different things but didn't arrived to a solution. Did you found a way to solve it, Pingu(@carlesUdG )?

markferreiro avatar Jan 19 '21 09:01 markferreiro

Same here. I've been one week trying different things but didn't arrived to a solution. Did you found a way to solve it, Pingu(@carlesUdG )?

I haven't found a way to solve it yet :( lets see if someone responds to this issue...

carlesUdG avatar Jan 22 '21 09:01 carlesUdG

Any new about this issue? @zolrath @skolmer

p3r1c0 avatar Jan 26 '21 14:01 p3r1c0

I believe the problem is here: https://github.com/Biarity/Sieve/blob/803055029e61691108d9da32c65f4c0078615f0e/Sieve/Extensions/OrderByDynamic.cs#L57. Maybe this null check should be avoided for Cosmos DB?

carlesUdG avatar Jan 26 '21 14:01 carlesUdG

This is also a problem for MongoDB.

HBTeun avatar Jan 27 '22 13:01 HBTeun