I have a Product collection stored in MongoDB. It has a attribute date :
const productSchema = new mongoose.Schema<ProductAttrs>({
date: {
type: Date,
required: true,
}
...
})
I would like to retrieve all products whose date is within last 6 minutes comparing with current time. What is the efficient way to retrieve that in mongoose ?
I am using express.js + typescript + mongoose v5.11 in my project.