How can I use a $in query to make the data returned by mongodb consistent with the order in which I entered it?

for example, the order in which I typed is {id: {$in: [1pg4]}}, how can I make the results returned by mongodb return the corresponding data in this order?

Mar.30,2021

what a strange requirement.
now that you know in advance what rules to sort by. Find the data and sort it in the application.

Menu