Mongodb background task

If possible, I would like to start the search and delete the query on non-indexed columns in the "background", without breaking other tasks or running out of memory to the detriment of others.

There is a background flag for indexing. Can I add an application to search / delete tasks?

Thanks for the tip

+5
source share
2 answers

This is not something you can use for "background: true" for. Perhaps the best way to handle this is to write a script that does this in the background. This script should start your operation in small batches with some delay between them. In pseudo code, you would do:

  • Find the 10 documents you need to update.
  • update these 10 documents
  • sleep
  • go to the first step.

, . , , , , - .

+2

, : true . . , , find/remove, .

+2

All Articles