Answer the question
In order to leave comments, you need to log in
How to make a selection in MongoDB by time?
Good afternoon.
The database has an array of data. Each entry in the array has a sent_at property .
How can I get only the data sent_at, which is not more than 1 minute from the current time?
Answer the question
In order to leave comments, you need to log in
First you have to calculate the current time minus 1 minute
const date = new Date();
date.setMinutes(date.getMinutes() - 1);
TableName.find( { sent_at: { $lte: date } } )
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question