Document DB $muliply query not working

0

We have created a documentDb instance having a 4.0.0 version. When running the query using $muliply it throws an error as Bad Query. **Query: 'test': { $multiply: ["$price", 8 ] } **When checking the documentation it says the $muliply is supported. Not sure why it throws a Bad Query

Rahul T
asked 2 years ago215 views
1 Answer
0

What is the error message you are getting? From the syntax of what you provided, it looks like you are missing brackets around your multiply aggregation expressions.

'test': { $multiply: "$price", 8 }

...should be...

'test': { $multiply: ["$price", 8]}

See more here: https://docs.mongodb.com/manual/reference/operator/aggregation/multiply/

AWS
Cody_A
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions