FAQ Database Discussion Community


Indexeddb slow retrieval issue

javascript,indexeddb
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:...

JayData provider failing to load for sqLite and indexedDb

javascript,jquery,sqlite,indexeddb,jaydata
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...

How to update an IndexedDB ObjectStore Name?

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?

Modifying an object using indexedDb

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?...

Safari 8 not for windows?

safari,cross-browser,indexeddb,pouchdb
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...

Deferred then of then is undefined for IndexedDb

javascript,jquery,indexeddb,jquery-deferred,canjs
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...

Cannot put() data to an indexeddb database using Firefox

javascript,firefox,indexeddb
Hi I created an Indexeddb database but having trouble input data into it. Database: var request = indexedDB.open("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...

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

jquery,html5,local-storage,indexeddb,offline-caching
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...

Check the real availability of IndexedDB in Firefox

javascript,firefox,indexeddb
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

javascript,jquery,indexeddb
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...

IDBKeyRange - openCursor vs get for retrieving the latest row

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

Indexeddb search all orders with a particular field

indexeddb
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...

IndexedDB: Can you manually initiate a version change transaction?

javascript,html,javascript-events,google-chrome-extension,indexeddb
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...

Composite unique index

javascript,indexeddb,composite-key
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...

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

javascript,indexeddb
I have code to create an indexedDB here: function create_db() { var indexedDB = window.indexedDB || window.webkitIndexedDB || window.msIndexedDB; var request = indexedDB.open(“photos”, 2); request.onupgradeneeded = function(event) { var db = event.target.result; // 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: retrieve the out-of-line key associated with a particular object in an object store

javascript,nosql,indexeddb,persistent-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...

PouchDB for Chrome Apps

javascript,html,google-chrome-app,indexeddb,pouchdb
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...

Delete all conflicts in pouchDB

couchdb,indexeddb,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...

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

javascript,jquery,asynchronous,indexeddb
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 = indexedDB.open('some name'); request.onsuccess = function(event) { obj.id = event.target.result } request.onerror = function(event) {...} The request variable is assigned a callback which is...

DBOpenRequest events do not fire

indexeddb
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 = window.indexedDB.open("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");...

Close a cursor in indexeddb with javascript

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

IndexedBD select objects from upper to lower?

javascript,database,html5,select,indexeddb
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,...

Making Large IndexedDB Persistent in Browser

sql-server,html5,browser,local-storage,indexeddb
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...

IndexedDB User Permissions

javascript,indexeddb
Good day, all I read on this page [Using IndexedDB]: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API/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: Modifying pre-existing objects in an object store

javascript,html,google-chrome,indexeddb,persistent-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...