How to convert Double to String in MongoDB 3.6?

Viewed 534

in aggregation pipeline i need to convert field from Double type to String. I have 3.6 version of mongodb, so i can't use $toString() or convert() operators.

I've tried operators $substr and $toLower in the next way:

{$project: {"totalScore": {$toLower: "$totalScore"}},
{$project: {"totalScore":  {$substr: [$totalSpent", 0, -1]}]}}}

It works, except if number is big it formats output string something like this: "1.55609e+06". And it's not suitable for me. May someone advise any other methods to achieve it? Didn't find another solution.

0 Answers
Related