What if you could multiply thousands of prices with one simple command instead of hours of manual work?
Why $mul operator for multiplication in MongoDB? - Purpose & Use Cases
Imagine you have a list of products with prices stored in a spreadsheet. You want to increase all prices by 10%. Doing this manually means opening each row and multiplying the price by 1.1 one by one.
This manual method is slow and boring. It's easy to make mistakes, like skipping a row or typing the wrong number. If you have thousands of products, it becomes a huge headache.
The $mul operator in MongoDB lets you multiply a field's value directly in the database. You can update many records at once with a simple command, saving time and avoiding errors.
for each product: product.price = product.price * 1.1 save product
db.products.updateMany({}, { $mul: { price: 1.1 } })With $mul, you can quickly and safely adjust numeric values across many records in one step.
A store owner wants to apply a 10% price increase to all items after supplier costs rise. Using $mul, they update all prices instantly without opening each product.
Manual updates are slow and error-prone.
$mul multiplies field values directly in the database.
This saves time and reduces mistakes when updating many records.