Search code examples
javascriptindexeddbydn-db

YDN-DB - How to update a record by id?


I'm using YDN-DB as my indexeddb wrapper; I've read the user guide and api, and have absolutely no idea how you'd update a record by id (primary key [auto incremented]).

Is anyone familiar with this/have any idea?

http://dev.yathit.com/ydn-db/getting-started.html


Solution

  • Figured it out (finally) - thanks for the great library Kyaw!

    The following code works:

    record = {id: 1, "setting": "test", "value": "value"};
    req = db.put({name: 'tblSettings', keyPath: 'id'}, record);
    req.done(function(key) {
      console.log(key);
    });
    req.fail(function(e) {
      throw e;
    });