Mongodb: Find every x days

1

[Mongodb] Staff, I have the following situation: I have several documents saved with the following structure:

{ ..., repetir : "semanal", a_cada: 2 }

In short, I have a cron running daily and I need to fetch the documents according to the configuration of each document. In the case of the above document, the query must return this document every two weeks. Since there are cases where the document will have different parameters, such as:

{ repetir : "diariamente", a_cada: 3 }

I thought about creating a start date and from there save the next dates according to the parameters of each document. But that does not seem legal ...

    
asked by anonymous 21.12.2016 / 00:08

0 answers