trying to optimize MongoDB queries