Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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)));
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #mongoose #operator #order #respected
ADD COMMENT
Topic
Name
8+9 =