Thank you,
Actually, I made MongoDB wrapper for collecting several collections
And, the wrapper is connected to a custom Dataset class
Thus, maybe I can build some valid index for the collections in the mongodb wrapper, which is pre-built index before training loops checking whether the document is valid or not
I got some hints from the answer. Thank you.