The judgment of IndexedDB to update data and add data

Business scenario:
AJAX returns the data res after sending the request, and the returned data is dynamic (maybe a lot, maybe very little). Maybe some need to be updated and some need to be added)
I want to implement a judgment to determine whether the ID is repeated or not, but because the IndexedDB .put (update) .add (add) is executed separately, it is not so powerful and intelligent, and the data of my AJAX may need to be added or updated in a JSON. So some people are at a loss and hope that the god can give some advice

success: function(res) {
    // 
    initDb();
    var users = JSON.parse(res);
    var tx = db.transaction("users", READ_WRITE);
    var store = tx.objectStore("users");
    var i = 0, len = users.length;
    while(i < len){
     var req= store.add(users[iPP]);
     req.onsuccess = function (evt) {
     console.debug("addData success:", evt.target.result);
     };
     req.onerror = function (evt) {
         // 
         //ID,
         //JS()
     };
    };
   };                                

answer your own questions. It seems that IndexedDB is too small. Few people use it.
is a semi-solution. Just use the .put method because I happened to see it on the document. If there is no put method, it will increase itself. So just put directly

Menu