I use IndexedDB, and I have two repositories of objects: equip (represents other equipment, the primary key is tagNo) and equipParts (represents parts of the equipment and has an index that is based on the tag number / serial number, the primary key is seqNo, with the tagNo field, which represents equipment, part of which is part).
If I delete an entry in the equipment, I want to delete all entries in equipParts with the NoO equip tag (just like equipParts.tagNo = equip.tagNo).
Excerpt from my code:
var tx = db.transaction(["equip", "equipParts"],"readwrite"); var estore = tx.objectStore("equip"); var pstore = tx.objectStore("equipParts"); var tagIndex = pstore.index("by_tagNo"); var pdestroy = tagIndex.openCursor(IDBKeyRange.only(tagno));
The problem is that only the record in the hardware is deleted; records in equipParts are stored there. Is there a way to delete multiple entries in the IndexedDB object store based on a non-unique index (which may be the main key of the parent object store)?
indexing cursor indexeddb
user2727708
source share