typicaljoe / taffydb

TaffyDB - an open source JavaScript Database for your browser
http://taffydb.com
MIT License
2.21k stars 286 forks source link

Does sort actually work? #173

Closed everythingability closed 3 years ago

everythingability commented 3 years ago

Hi,

i was just playing with taffydb and in this code I'd expect the sort() function to work, but it doesn't seem to.

https://editor.p5js.org/remarkability/sketches/9NFvQDZNH

Tom

realto619 commented 3 years ago

I had a similar issue in my testing, but I solved it by combining the sort with the forEach loop:

Instead of calling them separately: products.order("price asc"); products.each(...

Call them together (also note that instead of the normal "asc", the documentation shows it as "asec") products().order("price asec").each(function (r) { ... });

Working Example

Hope that helps!