knadh / localStorageDB

A simple database layer for localStorage and sessionStorage for creating structured data in the form of databases and tables
http://nadh.in/code/localstoragedb
814 stars 128 forks source link

limit before sorting #37

Closed orangecoding closed 10 years ago

orangecoding commented 10 years ago

Hi,

I've found a critical bug in your lib. If you query data using a limit, you sort the result after limiting it. E.g 1) A Table has 10 entries. 2) query(table, limit: 5, sort: asc) //not real code, just for instance.. 3) you sort the first 5 rows which I get.

The correct behaviour would be to sort the whole entries before you limit the result.

knadh commented 10 years ago

https://github.com/knadh/localStorageDB/commit/ad868130bb46fe1254a7e0c4c9bdb20cbe3ebc67 fixes this.