waits for mongo to establish connection, then queries
stash
flushes sockets