blinkdb icon indicating copy to clipboard operation
blinkdb copied to clipboard

where filter does not work on BOOLEAN property that is indexed

Open cpakken opened this issue 1 year ago • 0 comments

Bug only on indexed boolean property. Works find is 'done' prop is converted to number using 0 or 1

 const db = createDB()
  type Todo = { id: number; text: string; done: boolean }
  const todos = createTable<Todo>(db, 'todos')({ primary: 'id', indexes: ['done'] })

  await insert(todos, { id: 1, text: 'Buy milk', done: false })
  await insert(todos, { id: 2, text: 'Buy bread', done: true })

  const all = await many(todos, { where: { done: false } })
  //All is empty if indexes is 'done'
  //Works if does not have indexes

cpakken avatar Jun 19 '24 04:06 cpakken