I
I
ilovemaryjane2018-05-04 23:10:10
MongoDB
ilovemaryjane, 2018-05-04 23:10:10

What is an effective way to implement delayed publication of posts?

Hello.
I'm building a small API server on Node, Express, Mongo. There was a question how it is better to organize the delayed publication?
For example, I'm creating an Article document, and I don't want it to be used immediately by the application, but when I specify it.
What is the best way to do this so that there are no unnecessary checks, queries, filtering, etc.?
The first thing on your mind is to specify the PublishAt field and indicate the time there, but then the server will have to check each post once more before sending it to the client. And if there are 100 such posts and 1000 visitors? Caching and so on seems to be understandable, but how to implement everything correctly from the very beginning?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yan-s, 2018-05-04
@ilovemaryjane

When selecting published posts from the database, a condition is added, only posts where PublishAt is less than or equal to the current time are selected.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question