Regarding to What is the best way to create various IndexedDB objectStores within the same script? I created two objectstores :
var opinionObjectStore = thisDb.createObjectStore("opinion", {keyPath: "id", autoIncrement: false});
var commentObjectStore = thisDb.createObjectStore("comment", {keyPath: "id", autoIncrement: false});
Then I open a transaction and get the both objectstore:
var transo = myDataBase.transaction(["opinion", "comment"], "readwrite");
var opinionsObjectStore = transo.objectStore("opinion");
var commentsObjectStore = transo.objectStore("comment");
Then I create my "need to be stored" objects:
var comment = {id: "myid"};
var resp = commentsObjectStore.add(comment);
// other instructions [...]
var opinion = {};
opinion.id = tagElement.id;
var resp = opinionsObjectStore.add(opinion);
And I get an exception:
DataError: Data provided to an operation does not meet requirements.
[Break On This Error]
var resp = commentsObjectStore.add(comment);
Could you help me to let me add my comment and don't throw an exception?
I already read DOM IDBDatabase Exception 5 when adding data in indexedDB and Error "Data provided to an operation does not meet requirements" when trying to add data to indexedDB which do not help.