Changed code to work with one connection

This is an attempt to make mongo db more stable on BlueMix