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
gefragt vor 2 Jahren219 Aufrufe
1 Antwort
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
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen