D
D
Denis Laletin2016-12-06 17:14:42
JavaScript
Denis Laletin, 2016-12-06 17:14:42

How to delay the creation of a document for a day in mongodb?

I found that mongo has TTL indexes, but I don’t understand how to use them to create a document. It is possible to postpone the creation of the document somehow through nodejs. But if you do it by means of setTimeout, will there be any lags? Because many operations will have to be postponed. How is it right in mongodb to postpone the creation of a document for a day?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yustas Alexu, 2016-12-06
@Yuxus

You can put the document in another collection with the time specified. Then periodically check the time, if it has come up, copy the document to the desired collection.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question