I have to admit I'm very new to indexing DB
I wrote simple indexedDB code and it looks like this:
function go(){var req = window.indexedDB.open("Uploader", 1), db; req.onerror=function(e){console.log('Error')}; req.onsuccess = function(e){db=e.target.result;}; req.onupgradeneeded = function(e){console.log(db); db=e.target.result;db=e.target.result; var os = db.createObjectStore('Files', {keyPath:"files"}); os.createIndex('text', 'text_file', {unique:false}) var trans = db.transaction(['text'], "readwrite"); var objectstore= trans.objectStore("text"); var addreq = objectstore.add('Instructions.js'); addreq.onsuccess = function(e){console.log('Success!');console.dir(e)} }}
the error it gives me is Uncaught InvalidStateError: Failed to execute 'transaction' on 'IDBDatabase': A version change transaction is running.
He says that A version change Transaction is running , but as far as I learned, the version change transaction is made from the IDBFactory.open method, and I did not use it, and I indicated that this readwrite transaction, and this transaction in onupgradeneeded , why does it occur error?
I have to admit I'm very new to indexing DB
source share