I have seen multiple JavaScript examples of using createIndex
to define an ObjectStore index directly after the ObjectStore has been created like this:
var objectStore = ixDb.createObjectStore(osName, { keyPath: pkName, autoIncrement: autoIncrement });
objectStore.createIndex("name", "name", { unique: false });
Can anyone show me how you would use createIndex
on a pre-existing table without calling createObjectStore
? I guess the real question here is how to get a reference to the objectStore without using createObjectStore
?
I tried several variations of the following with no luck:
var objectStore = window.IDBTransaction.objectStore(ObjectStoreName);
var index = objectStore.createIndex(ixName, fieldName, { unique: unique, multiEntry: multiEntry });