const products=await Product.find().sort("condition")
In the above snippet, Product is my mongoose model. The above snippet sorts the result according to the condition but the snippet below does not:
let products=await Product.find()
const results=products.sort("condition")
I am following the "Node.js Projects" by Coding Addict on Youtube where he says that this is because using await returns a list where we cannot use the mongoose.sort() function.
So what I am trying to understand is why does the sort() function not work in the second snippet as I checked the types of the value returned in both snippets and it was Obj in both the cases.