While setting up Mocha tests, I noticed that they sometimes fail on startup because Mongo takes some time to setup its indices on the test data I am prefilling. For normal indices, this would not be noticeable, but geospatial queries fail if the geonear index is not available.
I workarounded this issue by setting a pretty large timeout (20s) before the tests are being run, but this is pretty annoying.
Is there a programmatic way to check if Mongo has already setup all indices?