I have a store with an auto-incremented primary key - a queue of offline posts.
this.version(2)
.stores({
'offlinepost': '++'
});
I grab the first record with
table('offlinepost')
.orderBy(':id')
.first()
That works, but I also need to know the ID of the record to update/delete. As it is an auto-increment, it is not included in the data.
I get around it by using .keys()
to get a separate array of keys to look up, but that seems like unnecessary work.
Is there a simple way to check a records ID that I may have missed?
I think you have to name your primaryKey to get it visible in objects.
so if you change to:
this.version(2)
.stores({
'offlinepost': '++myPrimaryKey'
});
you should get the primaryKey (autoincrement) in all your objects