You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I receive an array of objects from an API and would like to store them. Sometimes the objects match those already in the db and other times they've been altered. This sounds like a great use of upsert.
Unfortunately, the only way I can get this to work is
users.forEach(user=>{// will change only in memorydb.get('users').upsert(user).value()// you can also use `commit` if you don't need a returning value// db.get('users').upsert(user).commit()})// then write to filedb.write()
I receive an array of objects from an API and would like to store them. Sometimes the objects match those already in the db and other times they've been altered. This sounds like a great use of
upsert
.Unfortunately, the only way I can get this to work is
where
users
is the array of objects. Is there a better way to do this than callingwrite
in a loop?The text was updated successfully, but these errors were encountered: