The below query (without using sort) works well.
return Cars.find({ carColor : {$in: ["Black","Blue","Red","White","Silver","Orange"]}, carType : {$in: ["Subaru","Toyota","Aston Martin","BMW"]} , carPrice: { $lte: maximumPrice} })
but once I insert the sort method (seen at the end of the statement), it does not work.
return Cars.find({ carColor : {$in: ["Black","Blue","Red","White","Silver","Orange"]}, carType : {$in: ["Subaru","Toyota","Aston Martin","BMW"]} , carPrice: { $lte: maximumPrice} }).sort( { carPrice: 1 } )
I've tried sorting the query using many different tactics but none seem to work. I'm using mongodb3.2 .
Here is my insert:
Cars.insert({
carType : carType,
carColor : carColor,
carPicture : carPicture,
carStyle : carStyle,
carPrice : carPrice, //store it as a number
date : new Date
})
Thank you all in advance, much appreciated.