Sorting query results by the order of items in provided conditions array in Mongoose
问题 I am looking for a way to query a database with Mongoose based on an array of document IDs and return the results in the order in which they were presented to Mongoose within that array. For example if I provided Mongoose with this array ["112", "111", "113"] and assuming that all the documents with these IDs exist the result will be an array of documents ordered accordingly as: [{//112},{//111},{//113}] Just to be crystal clear, I don't need to sort the array by any specific document field -