ngx-indexed-db
ngx-indexed-db copied to clipboard
Support for "out-of-line" keys?
Do you support "out-of-line" keys?
If so, can you give an example of how to set the 'storeConfig' value and 'storeSchema' values?
My data already has an unique "id" field.
I am getting error: DOMException: Failed to execute 'add' on 'IDBObjectStore': The object store uses in-line keys and the key parameter was provided.
Thank you.
Hi @BruceWilcox, Can you share your storeConfig and a single data that you want a store? It seems to me that out-line-key not supported.
Thansk.
Hi @BruceWilcox,
if you already id for your entities should be configure your store in this mode:
Set id or your custom key for storeConfig with autoincrement false, and call method add, put and etc... without passing key.
Please see my project at https://github.com/iTipsDev/demo-angular-ngx-indexed-db
It works ok if records added one at a time. But fails when using bulk option. I need the better performance of the bulk option.
Hi @BruceWilcox, I tried your example but bulkAdd works fine for me. Are you sure your db is empty? Because if you do the normal add first and then the bulkAdd this won't work
I am still trying to get the same results are you are. Is "if you do the normal add first and then the bulkAdd this won't work" a documented limitation?
If you call the add method you wrote, it iteratively inserts each element of your json. BulkAdd does the same thing in a massive way, consequently if the db is not empty you are trying to insert duplicate elements (since you are working with the id of each element of the same json).