Skip to content

Add support for doing multiple updates at once #1

Open

Description

Right now, each update is an atomic document modification. Updating multiple fields simultaneously requires doing a raw update with MongoDB operators. That's particularly painful for arrays with the $each required.

There should be some sugar like this:

$obj->update_multi(
    set => [ field, value ],
    set => [ field, value ],
    push => [ field, value],
    ...
);

The underlying calls should be split into an update statement generator and an executor. Then update_multi could just generate multiple operations and put them in one update document to fire off to update.

I think the "signature" of each should resemble the individual call. For example, if update_set only takes a pair, then set should take an arrayref with a pair. Later, if update_set is modified to take a hash ref or multiple pairs, then maybe it could be modified here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions