I want to write an Angular module that saves data locally (with IndexedDB) and sync that data with server data via a RESTful service.
I have build a rudimental base for that already that can get data to the server and put it into the IndexedDB.
Because the web application has to run in offline mode too, I have chosen to use two keys for the object stores. A local ID which is autoIncremented and the ID of the entry on the server.
The server isn't aware of the local ID and the local data entry might not know the server ID if it can't be transmitted to the server
When I define an unique index for the server ID, the local entries won't get updated if the server ID already exists and the update process stops.
Is there a way to do this directly with the IDB API?
I have found a similar problem, but with the an simple cursor and cursor.update solution, there is no possibility to insert new data from the server to the local DB: Indexeddb - Update record by index key