Cast mongo port setting to int.

The Connection class currently used is deprecated. Also put some
checking in there just in case the port setting is passed in as a
string.