Skip to content

How best to merge list of new/updated objects into existing list #15

@jfsiii

Description

@jfsiii

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 => db.get('users').upsert(user).write())

where users is the array of objects. Is there a better way to do this than calling write in a loop?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions