couchbase/couchbase-lite-ios

Add Nulls Ordering support

maykonmeneghel opened this issue · 2 comments

We would like an improvement to be added to include Nulls Ordering support. When sorting a given field in ascending order, null values appear first. Currently, to get around this problem, we have to deal with two queries, one returning only valid values and the other with null values, and then we merge the result of the two queries, which implies a bad performance, since the Couchbase API has support for nulls ordering in the query itself. It seems to be a relatively simple solution.

Here, in the documentation you can see API support for Nulls Ordering:

https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/orderby.html

Here's an open thread dealing with the problem:

https://forums.couchbase.com/t/sorting-the-field-with-empty-value-always-at-the-bottom-of-the-lists/26023

Know issue from the underlying implementation (SQLite) order. Nothing we can do on our side