I am looking to count all columns with the name amount in the documents that match my query,
tickets.count({time: {$gte: a}, time: {$lte: tomorrow}}).then(function (numTickets) {
How can I get the total result of the document column called amount?
Example, if I do have:
{ time: 20, amount: 40}
{ time: 40, amount: 20}
it would return the total amount(60)?
Remember that I do need to use {time: {$gte: a}, time: {$lte: tomorrow}
in the query.
How would I do this?