Bug 862461 - Add in Mongo connection error handling.
Add middleware checking if Mongo Connection is active.
Restructure when connection was made for easier passing around of object
Fixed up default ready fn signature