multiple keyPath index (array index) should be explained, because of it's common usage but is not. #21598
Labels
area: IndexedDB
Content:WebAPI
Web API docs
effort: medium
This task is a medium effort.
help wanted
If you know something about this topic, we would love your help!
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/Using_IndexedDB
What specific section or headline is this issue about?
In general (the text and examples)
What information was incorrect, unhelpful, or incomplete?
The information about the index is correct, but in my opinion incomplete.
with indexedDB, you can create an index, which adds a constraint on 2 properties at the same time, and this also allows you to find something using both of these 2 properties together in a get request on the index. you can do this by passing in an array on the .createIndex and .get requests
Doing this is extremely common for when you want to do slightly more advanced things. but it's not explained.
I personally did not know that you could do this, so I think this would be beneficial.
What did you expect to see?
An explanation with examples, ideally integrated in the other example on the page.
A simple example I came up with. In the example. The idea of the example, is that we have a band store as well. and at some point: you have the id of the band, and the name of the album, but not the id. And you need to update or remove the album.
Creation Example
Getting Example
In my example I use unique: true, but not having the unique flag also has a lot of use cases.
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
MDN metadata
Page report details
en-us/web/api/indexeddb_api/using_indexeddb
The text was updated successfully, but these errors were encountered: