indexeddb , How to update an IndexedDB ObjectStore Name?

How to update an IndexedDB ObjectStore Name?


Tag: indexeddb

One way to do it is to create a new objectStore with the new name and copy the data of the original over, but is there a way to modify the name of the existing objectStore?


I took another look at the spec, and it does not look like there is a way to modify the name of an existing object store. Your idea of creating a new store, copying over the objects, and deleting the old store, is probably the only and best way.


IndexedDB User Permissions

Good day, all I read on this page [Using IndexedDB]: that browser will prompt user to give permission to create indexedDB, and the user may deny permission. See quote below: The most likely problem is that the user decided not to give your web app permission to create a...

IndexedDB: retrieve the out-of-line key associated with a particular object in an object store

Say I have an object store, which was created like this: IDBDatabase.createObjectStore(Name, {autoIncrement: true }); Now, say I retrieve an object from that object store using an index to look it up. Is there a way that I can retrieve the out-of-line key associated with the object so I can...

Indexeddb search all orders with a particular field

I have looked and looked everywhere but IndexedDb is not very famous it turns out. I have an objectstore called orders with an auto-generated key with each order's structure like: {"dealername":"something","dealerid":num,"totalbill":num,"items":[{},{}]} Now as the objectstore orders can have multiple orders with the same dealerid, how can I get all orders...

IndexedBD select objects from upper to lower?

For example: const customerData = [ { id: 444, name: "Bill", age: 35, email: "[email protected]" }, { id: 5555, name: "Donna", age: 32, email: "[email protected]" }, { id: 666, name: "Cat", age: 2, email: "[email protected]" }, { id: 888, name: "Gandalf", age: 21000, email: "[email protected]" } ]; function getDataByRange(db, table,...

HTML5 Indexeddb commands to read the data is not supporting in the Ipad Safari (version 8.1)

Query Description:- This question is particularly with the issues that I am facing in reading the indexeddb data in the Ipad Safari 8.1. I am able to create Indexeddb and insert the data into it. But unable to read the same in Ipad safari. Below is the code format that...

Deferred then of then is undefined for IndexedDb

I'm using CanJs and I'm learning jquery deferred but I have a problem. I created a controller as sort of Singleton to manage data in IndexedDb. First of all, I created an openDb function like this: openDbDeferred: null, openDb: function (dbName, dbVersion) { console.log('Open DB...'); var openDbDeferred = this.openDbDeferred; if...

How does a callback get executed when assigned after consuming method got called

Question: I am reading a book about the Html5 data storage IndexedDb. The IndexedDb API uses the following code to open a database connection: var request ='some name'); request.onsuccess = function(event) { = } request.onerror = function(event) {...} The request variable is assigned a callback which is...

IndexedDB: Modifying pre-existing objects in an object store

I am trying to wrap my head around IndexedDB. I created an object store that uses a key-generator with no key-path. var objectStore = db.createObjectStore("domains", {autoIncrement: true }); objectStore.createIndex("domain", "domain", { unique: true, multiEntry: true }); In order to access my records, I created an index that references my object...

Composite unique index

I have an object store which contains 3 indices, which are name,value and userid. How can I create a composite unique index from name and userid? This is what I tend to do: var objectStore = database.createObjectStore('data',{keyPath : ['name','userid']}); objectStore.createIndex('name','name'); objectStore.createIndex('value','value'); objectStore.createIndex('userid','userid'); Is keyPath good enough? Do I need to...

IndexedDB: Can you manually initiate a version change transaction?

I am writing a chrome extension that utilizes IndexedDB to store some information client side in an IDBObjectStore within an IDBDatabase. The nature of the data is such that I need my users to be able to modify the object store at their whim. (add new objects modify existing ones...

Delete all conflicts in pouchDB

my problem is to sync between pouch and couchDB. I will manage to get my documents from couchDb and check in the pouch if there is already an existing document. So, if we have a conflict I want so solve the conflict on the client-side. But I don't know how...

Cannot put() data to an indexeddb database using Firefox

Hi I created an Indexeddb database but having trouble input data into it. Database: var request ="BCDB"); request.onupgradeneeded = function() { var db = request.result; var store = db.createObjectStore("psf", { autoIncrement: true }); var psTag = store.createIndex("ps_tag", "psTag"); var psNameIndex = store.createIndex("ps_name", "psName"); var psResultIndex = store.createIndex("ps_result", "psResult"); var...

DBOpenRequest events do not fire

I'm struggling with opening indexed db. Here is my code: var db; window.onload = function() { window.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; var DBOpenRequest ="test", 1); DBOpenRequest.onerror = function(event) { console.log("DBOpenRequest.onerror"); }; DBOpenRequest.onsuccess = function(event) { console.log("DBOpenRequest.onsuccess"); db = DBOpenRequest.result; }; DBOpenRequest.onupgradeneeded = function(event) { console.log("DBOpenRequest.onupgradeneeded");...

Making Large IndexedDB Persistent in Browser

I am looking at making a LOB html5 web application. The main part we are trying to accomplish is to make the application offline capable. This will mean taking a large chunk of SQL data from the server and storing it in the browser. This will need to be living...

JayData provider failing to load for sqLite and indexedDb

I'm trying to use JayData using the sqLite provider via myDB = new MyDatabase({ provider: 'sqLite' , databaseName: 'MyDB', version: 1 }); But when It runs this line it echos to console the following message twice "Provider fallback failed!" I have tried manually loading the sqLite provider and not loading...

IDBKeyRange - openCursor vs get for retrieving the latest row

I tend to query for the latest record by one of these two queries. var range = IDBKeyRange.bound([1,0],[1,]); var article = db.transaction('article').objectStore('article').index('userid-date_created'); article.openCursor(range,'prev').onsuccess = function(e){ var rowA =; }; //or article.get(range).onsuccess = function(e){ var rowB =; }; The openCursor approach obviously works but I have no idea about...

How to update an IndexedDB ObjectStore Name?

One way to do it is to create a new objectStore with the new name and copy the data of the original over, but is there a way to modify the name of the existing objectStore?

Modifying an object using indexedDb

I am storing an object in IndexedDB, in the following format. var _object ={ stud1: { name: 'ABC', surName: 'PQR' }, stud2: { name: 'zxc', surName: 'ppp' } }; How do I update the object, so that the stud1 key would be removed?...

When using IndexedDB, how can I delete multiple records using an index that is not the key?

I have code to create an indexedDB here: function create_db() { var indexedDB = window.indexedDB || window.webkitIndexedDB || window.msIndexedDB; var request =“photos”, 2); request.onupgradeneeded = function(event) { var db =; // Create photo db var photo_store = db.createObjectStore("photos", {keyPath: "photo_id"}); var photo_id_index = photo_store.createIndex("by_photo_id", "photo_id", {unique: true}); var...

Indexeddb slow retrieval issue

Hello in my app I have at the moment (still under development) an indexed-db with 400 records in a single collection. The indexes are: id, vendor, price, model and subCategoryID. Here is a sample of a record: { id: 199, bundles: [235,548,983,918], categoryID:0 , subCategoryID: 7, imageUrl : "/mock/mobiles/Alcatel-One-Touch-Pop-S7.png" model:...

Check the real availability of IndexedDB in Firefox

I have to check the IndexedDB availability for the Firefox browser only. Currently I do the trick with this : var IDB_SUPPORTED = 'indexedDB' in window; Simple. But if I disable IndexedDB in about:config (with the dom.indexedDB.enabled parameter), IDB_SUPPORTED is still true. How can I check the real availability of...

jQuery.Deferred() is not working properly

I'm trying to implement indexedDB. For that I need to use $.Deferred to get the status of database creation. But the problem is, Differed is not working as expected. Here is the fiddle, you can find the process in the console. And here is the code: $(function($) { var table...

PouchDB for Chrome Apps

I'm making a Chrome App and using PouchDB(all my first time). Got the IndexedDB running on the Resources panel of the DevTools. The problem is the adding and updating of data to PouchDB. It's not working. Here's the code: (app_jr.js) var saveregister, JrRegisterObj, pn; JrRegisterObj = function (databasename, remoteorigin){ 'use...

Safari 8 not for windows?

I'm trying to execute my program cross-browser and I found that Apple's Safari for windows ends with version 5.1.7! But when I searched all over the internet to acquire Safari 8, I found that they had no support for windows. I very badly want Safari 8 for windows since it...

Close a cursor in indexeddb with javascript

Is there way to close all cursors in an indexeddb? I need to stop all the currently open cursors using javascript.