Cleaning up IndexedDB Object stores

I am implementing the use of IndexedDB storage in my webapp (Chrome only) which stores a sequence of records along the lines of {raw:"string",id:"string",dayUsed:number}whereid - is the unique string identifying the object (used as the indexedDB objectstore keydayUsed - records the last day (since Date(2013,11,10)) that the object was used.As the app is used the number of records in this store will grow. I want to keep tabs on what is happening in this object store with a view to pruning it whenThe number of records in the store exceeeds a pre...Read more

using data from multiple indexeddb objectstores

I have 2 objectstores in 1 indexeddb database.I can add, retrieve, show and delete the records from either without a problem.However, what I cannot do is keep the data alive in some way after the transaction ends on one objectstore so I can use it together with the data from the second objectstore.For example comparing values from one store to the other.I have assigned arrays in each transaction and pushed the results into those arrays but when I come out of the transaction everything becomes undefined.I am so tired of looking at 1 page "todo l...Read more

Retrieving Data From IndexedDB

I am new in IndexedDB. I need to fetch data as per my requirement.Requirement is :-I have one object stored in IndexedDB.Object Format is : -var _obj = { COL_TITLE : '1', COL_ID : 'proxyserver#1235', COL_NAME : 'proxyserver', COL_VERSION : ['TASK#1','TASK#2','TASK#3','TASK#4']}I want to fetch data according to 'TASK#2'. For this i had created index 'VERSIONINDEX' using'VERSIONINDEX', 'data.COL_VERSION', {unique:false});Using this index i am fetching record. but i got empty array.can anyone tell me how i c...Read more

can you permanetly store data with indexedDB while working with pouchdb

I've just started working with PouchDB it's big takeaway being the ability to store data locally in a JavaScript environment (browser) using indexedDB as well as syncing it to a CouchDB database remotely for a more permanent storage.My question is how realistic is it to work with PouchDB to achieve permanent data storage locally with zero to little remote syncing with a CouchDB database. I'd essentially want to achieve this without having to install any services/applications locally other than the browser.Is it safe to assume indexedDB database...Read more

How to map mulit-level object to indexedDB for best efficiency

My question concerns laying out a data structure within indexedDB. I started out building a small web page feature that grew into something more of a web learning tool to now more closely to a stand-alone progressive web application. Using localStorage has worked well but since the tool has grown, the 5MB limit may become a problem for some users; so, there is a need to switch to indexedDB. The application is for desktops only and allows the user to build a portfolio of modules and save the data to the hard drive as a JSON string. When the us...Read more

Getting the id of an object added to an indexedDB object store

Given a indexeddb database with one declared objectstore as:var objectStore = thisDb.createObjectStore("table", {keyPath: "id", autoIncrement: true})When I add an new item with the add request:var resp = objectStore.add(row)How can I get the new id of this added item in the onsuccess function?resp.onsuccess = function(e) { /* code to get the id of the added item */}...Read more

How to create multiple object stores in IndexedDB

I don't know if I'm right or wrong. But as I know I can't create a version change transaction manually. The only way to invoke this is by changing the version number when opening the indexed DB connection. If this is correct, in example1 and example2 new objectStore will never be created?Example1function createObjectStore(name){ var request2 ="existingDB"); request2.onupgradeneeded = function() { var db = request2.result; var store = db.createObjectStore(name); };}Example2function createObjectStore...Read more

How do I specify key when adding records to objectStore w/ in IndexedDB?

Trying to learn the concepts and API of IndexedDB and I'm struggling trying to figure out how to specify keys for an objectStore using the IDBObjectStore.add method. According to the spec, the first parameter is the value and the second optional parameter is the key. I can add a record when I supply an object that has Bar as a property of the value (which is an object), but when I try to pass the key in through an object via the second parameter, the add attempt fails and the details that I get are:Code: 5. Message: DataError: DOM IDBDatabase...Read more

Can I specify a 'unique together' constraint in an IndexedDb objectstore?

I use IndexedDb to store some data for offline use. I need to make sure that in an objectstore no two objects have same certain attributes.For ex the object in my object store which stores details of movies are as such:{title : value1, director : value2, writer : value3, revenue : value4} Now, when I add data I dont't want 2 objects with same {title , director, writer}.From what I have explored, I can create an index on a field and specify unique = true for this index. This way no 2 objects can have the same value for this particular field. But...Read more

Does indexedDB support foreign keys? If not, can I simulate foreign keys?

I'm building a web app that utilizes IndexedBD. I'm coming from a SQL background, so the concepts are different. Specifically, my understanding is that there's no real concept of a "foreign key" in indexedDB. As such, I'm trying to figure out the quickest way to retrieve a related object that, in the SQL world, would be the a foreign key. For example, with SQL, suppose we have the following tables: table carBrand: brandName brandInitialtable carModel: modelName brand (FK)Now, if we have a record in carBrand which holds brandName=Ford, brand...Read more

How to sync indexedDB local data with Server?

I have a small project which stores data in IndexedDB in browser. I would like to add sync functionality so users can access the data everywhere. How can I sync local IndexedDB data in a remote server or server database so I can access it everywhere? In other words, I would like to make this demo available in all of my browsers. (Security is not a problem in this phase)...Read more

indexeddb - PouchDB Date/String conversion during Save/Load on iOS Safari

Date on Safari for IOS get's converted to string during save/loadChrome for MacSaving object with date field ( = new Date()) to PouchDB database Read the same object - typeof === object (and it's a proper Date)Safari for iOSSaving object with date field ( = new Date()) to PouchDB database Read the same object - typeof === stringSo, in Chrome I get type persisted and on Safari not. Problem is when using this field in <input type="date"> - Works on chrome but not on Safari.Fiddle: more

indexedDB cross-browser not there yet?

Has anyone else found that IndexedDB stores created in Chrome aren't visible in Firefox and visa-versa?I created some on in each browser, but I can only see the ones there from the browser that created it. This is telling me that IndexedDB is not ready for prime-time...Read more