[setup] Changed the order in which mongoose connects to database. Closes #111.