Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "_id" : ObjectId("59816ac004ca1760a45957d0"),
- "userEmail" : "lk@gmail.com",
- "expenseAmount" : 500,
- "expenseRemark" : "raj",
- "expenseCategory" : "transport",
- "transactionType":"debit",
- "entryTime" : ISODate("2017-08-02T06:01:26Z"),
- "__v" : 0
- },
- {
- "_id" : ObjectId("59816acb04ca1760a45957d1"),
- "userEmail" : "lk@gmail.com",
- "expenseAmount" : 100,
- "expenseRemark" : "pet",
- "expenseCategory" : "pets",
- "transactionType":"debit",
- "entryTime" : ISODate("2017-08-02T06:01:37Z"),
- "__v" : 0
- },
- {
- "_id" : ObjectId("597d7a9c04ca1760a45957d2"),
- "userEmail" : "lk@gmail.com",
- "expenseAmount" : 500,
- "expenseRemark" : "gt",
- "expenseCategory" : "sports",
- "transactionType":"debit",
- "entryTime" : ISODate("2017-07-30T06:20:04Z"),
- "__v" : 0
- },
- {
- "_id" : ObjectId("597d7aaa04ca1760a45957d3"),
- "userEmail" : "lk@gmail.com",
- "expenseAmount" : 560,
- "expenseRemark" : "mov",
- "expenseCategory" : "entertainment",
- "transactionType":"debit",
- "entryTime" : ISODate("2017-07-30T06:20:14Z"),
- "__v" : 0
- }
- db.expenses.aggregate(
- [
- {
- $match:{"userEmail":"lk@gmail.com","entryTime":{"$month": 7}}
- },
- {$group:{ _id : null, total : {$sum : "$expenseAmount"}}}
- ]
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement