I have a schema like this
const someSchema = new mongoose.Schema (
{
updatedAt: { type: string }
}, { timestamps: { currentTime: () => moment().format("MM/DD/YY, h:mm") } }
);
I want to query this collection to find the documents updated within a date range for example:
12/05/20 to 12/31/20, hours and minutes don't matter. My startDate and endDate is in the YYYY-MM-DD format. I have tried to find
updatedAt: {
$gte: new Date(startDate),
$lte: new Date(endDate)
}
or
updatedAt: {
$gte: startDate,
$lte: endDate
}
but they are not working. Thank you for your time!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…