schema.FakturSchema.aggregate(
[
{
$match: {
statusPengambilan: statusPengambilan,
// sisa: { $gt: 0 },
tanggalTerima: {
$gte: new Date(tanggalAwal),
$lte: new Date(tanggalAkhir),
},
},
},
{
$group: {
_id: {
tanggal: { $dayOfMonth: "$tanggalTerima" },
bulan: { $month: "$tanggalTerima" },
tahun: { $year: "$tanggalTerima" },
// nomorHP: "$nomorHP",
},
totalHarga: { $sum: "$totalHarga" },
},
},
],
(err, result) => {
if (err) {
reject(err);
} else {
resolve(result);
}
}
);
Created
September 30, 2022 12:18
-
-
Save solanoize/2c3da97bc9b50a6ea9f36f502ecf5f04 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment