samuk190 / localbase

A Firebase-Style Database ... Offline!

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to get a list of document in a collection based on mulitple keys and not just id.

umang-goyal opened this issue · comments

commented

My collection is something like :

'key_1' |  { id: 1, name: 'max', dept: 'engineering' }
'key_2'. | { id: 2, name: 'manu', dept: 'finance' }
'key_3' | { id: 3, name: 'milan', dept: 'engineering' }

I want to get all the employees with dept === 'engineering'. How can we do it using localbase ?

In indexdb there is feature to add indexes.
eg.
objectStore.createIndex('dept_index', ['dept'], {unique: false});

How to mimic this in localbase ?

This issue is old, so I'm not sure if you still need help or not. If you still need help create a issue with label QUESTION

Thanks!