Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for doing multiple updates at once #1

Open
dagolden opened this issue Sep 24, 2013 · 0 comments
Open

Add support for doing multiple updates at once #1

dagolden opened this issue Sep 24, 2013 · 0 comments

Comments

@dagolden
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants