Details
-
Bug
-
Resolution: Fixed
-
Major
-
bug-backlog
-
Security Level: Public
-
None
-
Untriaged
-
Unknown
Description
fdb_iterator_seek_to_max() returns FDB_RESULT_INVALID_ARGS if called on an iterator that was created via fdb_iterator_sequence_init(). This makes it impossible to iterate sequences in reverse order.
(I thought of getting the database's last sequence and manually seeking to that value ... but there's no API to seek to a given sequence, i.e. no fdb_iterator_seek_seq() function.)
Couchbase Lite needs to be able to iterate sequences in reverse order*. The only workaround I can think of is to iterate forwards, capture the results in an array, and then reverse the array; but this requires iterating over every document in the database and storing that many results in memory, which isn't practical.