"Unrecognized expression '$toInt'"

I always get this error while trying to convert string to int. Expression is
db.movies.aggregate([$addFields: {"num_awards": {$toInt: "$num_awards.1"}}])

Please take a look at:


I’ve already gone through that. Thanks.
The thing is you’ve pointed me to the documentation of mongoDB version 4.0 whereas the cloud version used in this course is 3.6.9 and the $toInt() wasn’t introduced until version 4.0.

Probably that’s why I got an error,the syntax is right,otherwise.


This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.