bramski / angular-indexedDB

An angularjs serviceprovider to utilize indexedDB with angular
165 stars 49 forks source link

Need help creating complex keys #50

Open newbie-gk opened 9 years ago

newbie-gk commented 9 years ago

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!

seanmavley commented 8 years ago

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