javascripttaffydb

TaffyDB, filter the same field 2 times (greater then and less then)


I would like to query a range in a TaffyDB (Greater then x but less then y). What I try is:

mydb({myvalue:{gt:2700},myvalue:{lt:3000}})

But for sure that can not work this way. The second myvalue just overrites the first one in the Object.

A work around would be to create the db-record with a cloned myvalue (=> myvalue1, myvalue2) and then query it this way:

mydb({myvalue1:{gt:2700},myvalue2:{lt:3000}})

But it would be a bit dirty.

Anyone got a solution?


Solution

  • That works:

    mydb({myvalue:{gt:2700}},{myvalue:{lt:3000}})