How do I get the Last Insert Id from a JayData transaction?
Using JayData to insert a new object (record) into a Sqlite database, how do I query for the last insert id? I can do it like this but it seems inelegant: DB.Members.orderByDescending('member.Id').take(1).toArray(function(member){ alert(member.Name); }); If you have defined the Member class with auto-incremented Id, there is no additional query you have to write, because the Id property is filled automatically after the saveChanges() . To define a auto-incremented Id to your class, check if you have written this: $data.Entity.extend("Member", { Id: { type: "int", key: true, computed: true }, .