Answers for "mongoose $in operator order not respected"

0

mongoose $in operator order not respected

//just reorder the resulting array like so
docs.sort((a, b) => ids.findIndex(id => a._id.equals(id)) - 
                    ids.findIndex(id => b._id.equals(id)));
Posted by: Guest on March-17-2021

Code answers related to "mongoose $in operator order not respected"

Code answers related to "Javascript"

Browse Popular Code Answers by Language