I am using IndexedDB (through Linq2IndexedDB nugget) in my Windows8 application to deal with local storage. I need to retrieve last auto-incremented ID inserted in my local database (the equivalent of mysql_insert_id). How can I proceed?
I retrieve my records with:
db.linq.from("favoriteSearches").select().then(function(searches) {
// ....
});
But I have no trace of the key in searches.
If the object store has a keyPath, the object will contain the key in the property defined in the key path.
If you didn’t define an database configuration, linq2indexeddb runs in autogenerate mode. This means object stores and indexes are created when you need them. If this is the case and the object store is auto created, the keyPath for the object store is “Id” and in the return data you should find the key value in the “Id” property
Edit:
If you take the latest version of the linq2indexedDB lib 1.0.13 you will the key back when inserting data