dominictarr / level-live-stream

MIT License
80 stars 11 forks source link

lt,gt,lte,gte #15

Open dominictarr opened 10 years ago

dominictarr commented 10 years ago

in time for lxjs

dey-dey commented 10 years ago

+1 these don't seem to work.

i am currently using { start: '[start key value]', limit: 1 } to get this to work.

dominictarr commented 10 years ago

Oh, what version of level-sublevel are you using? npm ls level-sublevel if you are still on the legacy version (5.x.y) then lt,gt ranges arn't supported)

what options where you using? start is equivalent to gte

dey-dey commented 10 years ago

well locally it was installing and using level-sublevel @ 4.0.2, which didn't work so I updated to latest which installed at 6.3.1 and used the above to get it to work.

btw I have this PR for updating level-sublevel: https://github.com/dominictarr/level-live-stream/pull/18

using lte or gte I kept seeing this error thrown here in level-sublevel that items were not comparable where a was a key and b was undefined. the compare function being called is here

dominictarr commented 10 years ago

Ah okay, v4 is really old, it's not very different to v5 though, but v6 has some major changes. if you are using a updating level-sublevel with an database from 5 or before you MUST use require('level-sublevel/legacy') and i'd advise running it first with a copy of the database. There is also a migration tool: https://github.com/calvinmetcalf/sublevel-migrate

lets discuss this in irc, it would help if I was able to reproduce your problem.