Connecting to mongodb using hostname and ip