Improved MongoDB test script