I have a table in MongoDB in which I can get the fields in descending order sorted by system_id
db.job_parameters_mongo.find().sort({system_id : -1})
This is fine but gives me incorrect result as system_id is string field.Is there any way that I can convert system_id to number before ordering in descending order.I saw on this site that there is a way to do this using forEach (how to convert string to numerical values in mongodb) but that uses a function.Isn't there any other way like we have to_number in rdbms?