I have a collection with:

name    weight    amount
—————————————-
apple     2               3
banana  2               5
pear       2               5

I want add a column about the total price, which is equal to weight * amount

name    weight    amount    total
—————————————————-
apple     2               3              6
banana  2               5             10
pear       2               5            10

Method 1: collection.find() + update_one()

Method 2: collection.aggregate() with $project, $multiply and $out

Close Panel