Created
May 7, 2015 20:22
-
-
Save jrf0110/6328ee16a5713dc9ee30 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tx = dirac.tx.create(); | |
utils.async.series([ | |
tx.begin.bind( tx ) | |
// Remove items | |
, tx.payment_summary_items.remove.bind( | |
tx.payment_summary_items | |
, { payment_summary_id: $where.id } | |
) | |
// Add items | |
, items.length > 0 | |
? tx.payment_summary_items.insert.bind( | |
tx.payment_summary_items | |
, items | |
) | |
: utils.async.noop | |
// Update the original document | |
, Object.keys( $update ).length > 0 | |
? tx.payment_summaries.update.bind( | |
tx.payment_summaries | |
, $where | |
, $update | |
, options | |
) | |
: utils.async.noop | |
, tx.commit.bind( tx ) | |
], callback ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment