(fix) Moves Mongoose connection inside tasks