daily pastebin goal
23%
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. db.comment_object.aggregate([{
  2.         $match: {
  3.             $and: [{
  4.                 "beneficiaries": {
  5.                     $exists: true
  6.                 }
  7.             }, {
  8.                 "beneficiaries.0": {
  9.                     $exists: true
  10.                 }
  11.             }],
  12.             "last_payout": {
  13.                 "$gte": "2018-03-01T00:00:00",
  14.                 "$lt": "2018-06-09T00:00:00"
  15.             },
  16.             "total_payout_value": {
  17.                 "$gte": 0.001
  18.             }
  19.         }
  20.     },
  21.     {
  22.         $unwind: "$beneficiaries"
  23.     }, {
  24.         $group: {
  25.             _id: "$beneficiaries.account",
  26.  
  27.             author_gbg: {
  28.                 $sum: "$total_payout_value"
  29.             },
  30.             beneficiary_gbg: {
  31.                 $sum: "$beneficiary_payout_value"
  32.             },
  33.             curator_gbg: {
  34.                 $sum: "$curator_payout_value"
  35.             }
  36.         }
  37.     }
  38. ])
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top