Mongodb – JavaScript: Functional way to generate an array with fewer elements, from another with more elements
I'm trying to do this: I have an array of objects with the detail of a sale, with this format: [ { product:Banana, quantity:34, ...(other fields) }, { product:Apple, quantity:11, ...(other fields) }, { product:Banana, quantity:15, ...(other fields) }, {…