[GH-ISSUE #120] Incorrect query result with skip()/take() when items are sorted in descending order (possibly related to indices) #69

Closed
opened 2026-05-23 08:29:04 -06:00 by gitea-mirror · 2 comments
Owner

Originally created by @SilentAntenna on GitHub (Jun 19, 2022).
Original GitHub issue: https://github.com/appy-one/acebase/issues/120

Originally assigned to: @appy-one on GitHub.

Version 1.21.6.

Suppose that the form of each item looks like this:

{
  "name": "indexed_property",
  "age": "data" 
}

And we created an index for the name property:

db.indexes.create('myTable', 'name');

Then we construct a query in the following manner:

db.query('news').sort('name', false).take(5).skip(20);

The query will not skip items properly.

This is probably related to line 707-712 of acebase/src/api-local.js. We sort the items in a descending way but toss the first value every time.

Originally created by @SilentAntenna on GitHub (Jun 19, 2022). Original GitHub issue: https://github.com/appy-one/acebase/issues/120 Originally assigned to: @appy-one on GitHub. Version 1.21.6. Suppose that the form of each item looks like this: ``` { "name": "indexed_property", "age": "data" } ``` And we created an index for the `name` property: ``` db.indexes.create('myTable', 'name'); ``` Then we construct a query in the following manner: ``` db.query('news').sort('name', false).take(5).skip(20); ``` The query will not skip items properly. This is probably related to line 707-712 of `acebase/src/api-local.js`. We sort the items in a descending way but toss the first value every time.
gitea-mirror 2026-05-23 08:29:05 -06:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@appy-one commented on GitHub (Jun 22, 2022):

I published v1.21.7 which should have fixed this. Let me know!

Spread the word contribute Sponsor AceBase

<!-- gh-comment-id:1163614922 --> @appy-one commented on GitHub (Jun 22, 2022): I published v1.21.7 which should have fixed this. Let me know! [![Spread the word](https://user-images.githubusercontent.com/26569719/169265089-3d593555-e1ad-4390-986b-877ac2c38a47.svg)](https://twitter.com/intent/tweet?button=&url=https://github.com/appy-one/acebase&text=I'm+using+@AcebaseRealtime+in+my+project+to+make+my+life+easier!&button=) [![contribute](https://user-images.githubusercontent.com/26569719/169265318-30c4c6a5-7c89-46a0-a7a2-ef433a8192f4.svg)](https://github.com/appy-one/acebase#contributing) [![Sponsor AceBase](https://user-images.githubusercontent.com/26569719/168233053-8e56b243-4140-40ab-9a30-4cb3cc149bfe.svg)](https://github.com/sponsors/appy-one)
Author
Owner

@SilentAntenna commented on GitHub (Jun 23, 2022):

Problem fixed. Thanks!

<!-- gh-comment-id:1163981722 --> @SilentAntenna commented on GitHub (Jun 23, 2022): Problem fixed. Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/acebase#69
No description provided.