[Solved] Sorting the collection, why 1,2,3,378,4? not 1,2,3,378,4? Do I miss something?

I’m trying to sort the collection which I have created persId as the sequence.
Then I try to sort it, I have the data -> 1,2,3,4,378
My code is persons: Persons.find({}, { sort: { persId: 1 }}).fetch(),
It sorts as 1,2,3,378,4
How can I sort as 1,2,3,4,378?

The numbers you’re trying to sort are likely not actually numbers but strings, so convert them to numbers before you sort.

1 Like

Thank you very much, nlammertyn!!!