Retrieve indexes only #1269
-
Hello, I'm wondering, is there a way to retrieve only the primary keys and indexed properties of a collection, instead of loading the entire records (for performance reasons)? I see the |
Beta Was this translation helpful? Give feedback.
Answered by
dfahlander
Apr 11, 2021
Replies: 1 comment 3 replies
-
There is no such possibility in the IndexedDB API. The closest you could come is to use a compound index that contains the properties you need and retrieve all those indexes. const db = new Dexie('dbname');
db.version(1).stores({
myTable: 'id, [id+firstName+lastName+age]'
});
const result = await db.myTable.orderBy('[id+firstName+lastName+age]').keys(); The [["id1", "firstName1", "lastName1", 21], ["id2", ...]] |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
bwbb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is no such possibility in the IndexedDB API. The closest you could come is to use a compound index that contains the properties you need and retrieve all those indexes.
The
result
would give you: