Answer the question
In order to leave comments, you need to log in
How to skip records in mongo?
Hello. The task is this:
- there is a collection of data that is added every second
- you need to get 24 records (for the last 24 hours)
Here is the algorithm for what I need:
const found = []
for(let i = 0; i < КОЛИЧЕСТВО ВСЕХ ЗАПИСЕЙ; i++) {
if(found.length == 24) {
break;
}
if(i % 3600 == 0) {
found.push(data[i]);
} else {
continue;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question