{"action":"opened","issue":{"url":"https://api.github.com/repos/SitePen/dstore/issues/160","labels_url":"https://api.github.com/repos/SitePen/dstore/issues/160/labels{/name}","comments_url":"https://api.github.com/repos/SitePen/dstore/issues/160/comments","events_url":"https://api.github.com/repos/SitePen/dstore/issues/160/events","html_url":"https://github.com/SitePen/dstore/issues/160","id":111281788,"number":160,"title":"specifying idProperty in dbConfig for IndexedDB prevents store from being created...","user":{"login":"ddolga","id":1516444,"avatar_url":"https://avatars.githubusercontent.com/u/1516444?v=3","gravatar_id":"","url":"https://api.github.com/users/ddolga","html_url":"https://github.com/ddolga","followers_url":"https://api.github.com/users/ddolga/followers","following_url":"https://api.github.com/users/ddolga/following{/other_user}","gists_url":"https://api.github.com/users/ddolga/gists{/gist_id}","starred_url":"https://api.github.com/users/ddolga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ddolga/subscriptions","organizations_url":"https://api.github.com/users/ddolga/orgs","repos_url":"https://api.github.com/users/ddolga/repos","events_url":"https://api.github.com/users/ddolga/events{/privacy}","received_events_url":"https://api.github.com/users/ddolga/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-13T22:07:49Z","updated_at":"2015-10-13T22:07:49Z","closed_at":null,"body":"In dstore/db/IndexedDB the idProperty is specified inside the store object:\r\n\r\n var dbConfig = {\r\n            version: 1,\r\n            name: \"testwarn-db\",\r\n                options: {\r\n                    idProperty: \"chkSum\",\r\n                    chkSum: {\r\n                        indexed: true\r\n                    }\r\n                }\r\n            }\r\n        }\r\n\r\nThis is where the constructor method looks for it:\r\n\r\n if (!db.objectStoreNames.contains(storeName)) {\r\n                                <b>var idProperty = storeConfig.idProperty || 'id'</b>;\r\n                                var idbStore = db.createObjectStore(storeName, {\r\n                                    keyPath: idProperty,\r\n                                    autoIncrement: storeConfig[idProperty] &&\r\n                                    storeConfig[idProperty].autoIncrement || false\r\n                                });\r\n\r\nHowever later on when it scans the store for indexes:\r\n\r\n for (var index in storeConfig) {\r\n                                if (!idbStore.indexNames.contains(index) && index !== 'autoIncrement'\r\n                                   <b>// && index !== \"idProperty\" // hack to get to work</b>\r\n                                    && storeConfig[index].indexed !== false) {\r\n                                  <b> idbStore.createIndex(index, index, storeConfig[index]);</b>\r\n                                }\r\n                            }\r\n\r\nan error is thrown in  \"idbStore.createIndex(index, index, storeConfig[index]) : \"third parameter is not an object\". This is because its passing the \"idProperty\" into the createIndex method. I had to modify the code to also check that \"index !== \"idProperty\" in order to get this to work.\r\n"}}