angular-indexedDB icon indicating copy to clipboard operation
angular-indexedDB copied to clipboard

Need help creating complex keys

Open newbie-gk opened this issue 9 years ago • 1 comments

I'm new to indexedDB and trying to create complex keys as the example below, but it is giving me error

var aStore = db.createObjectStore('aStore', {keyPath: ['a_id', 'b_code']}); a.createIndex('c_idx', {'c' : ['c.d', 'c.f']} , {unique: false});

ERROR Uncaught SyntaxError: Failed to execute 'createIndex' on 'IDBObjectStore': The keyPath argument contains an invalid key path.(anonymous function) @ app.js:29applyNeededUpgrades @ angular-indexed-db.js:52dbReq.onupgradeneeded @ angular-indexed-db.js:131 angular.js:10627 $indexedDB: myIndexedDB database deleted.

Examples using angular-indexedDB to create/use complex keys are much appreciated

Thanks!

newbie-gk avatar Oct 26 '15 08:10 newbie-gk

I don't think compound keys are allowed in the keyPath (_id field, if thinking in MongoDB), at least, as per the error.

seanmavley avatar Apr 01 '16 13:04 seanmavley