The coll collection has the following two pieces of data

{

“tran” : “6”,

}

{

“tran” : “10”,

}

db.coll.find().sort({“tran”:1})

The result tran:10 came first. How do you modify this statement to sort the numbers?

The premise is that the tran type of mongodb collection cannot be modified.

All values of tran must be the same length in order to be sorted properly. For example: “06”, “10”