Factor out connecting to mongodb.

commit 8f9713fbeee9ce19b87b57d8d3c86ff9c236a064
Author: John Caldas <johntcaldas@gmail.com>
Date:   Fri Sep 19 20:54:32 2014 -0400

    Factor out connecting to mongodb.

commit bdb7c93a3584b252c71e5ca2caf3afa0e8f1292d
Author: John Caldas <johntcaldas@yahoo.com>
Date:   Fri Sep 19 19:27:06 2014 -0400

    Minor refactor for consistency.