Hi,
Any body help me. I am using mongdb aggregate simple query but not return any result.
$data = Transaction::aggregate( [ [ "\$match" => [ "shift_id" => new ObjectID($data['shift_id']) ], ], [ "\$group" => [ "_id" => [ "payment_method" => "\$paymentMethod" ], "total" => [ "\$sum" => "\$transactionAmount", ] ], ], ] );
But when i run this query mongo and it returns result.
db.transactions.aggregate([ { $match: { shift_id: ObjectId("593d0ed750692f04ca6f2e44") } }, { $group: { _id: {paymentMethod:"$paymentMethod"}, "total": {$sum:"$transactionAmount"} } } ])
Thank you