0
I am new in the area and would like to put a difficulty that I am having .. In the Mongo database I have an example table (returning this json)
{
"_id": "5cb7652fc278309ac78dce2b",
"status": "Teste 123",
"accessTokenKey": "exemplo",
"accessTokenSecret": "exemplo",
"dateToPost": "2019-04-15T14:45:28Z",
"dateTime": "2019-04-17T17:41:03Z",
"isPosted": false,
"__v": 0
}
First of all I need to do the following...
Compare the dateToPost
with the current time so that if the current time is longer, another useful comes into action and sends the post (is an app to post on twitter with scheduling, just for study), then it changes the state of the isPosted
of false
, for true
I stopped here, if you do not want to speak the answer tells me kindly how to look is already of great size, thank you very much
Note: I can also filter with this code
Tweet.find({isPosted: false}, await function(err, tweets) {
if (err) throw err;
res.send(tweets);
})
}
but I can’t get the property of dateToPost to subtract =/