Database handle with mongodb connections.
Methods
-
private, inner _local() → {object}
-
_local Connection method. Make a connection with localhost MongoDB test Database. Change the connection constants in Config Database Module(\Config\DatabaseConfig).
Returns:
object - MongoDB:Local Connection. -
private, inner _production(req, res) → {object}
-
_production Connection method. Make a connection with Heroku MLabs that is production Database.
Parameters:
Name Type Description req
object Express requisition object. res
object Express response object. Returns:
object - MLab:Heroku Connection.- To Do:
-
- Use process.env.MONGODB_URI instead hardcoded connection string
- Write comments
-
inner init() → {object}
-
Init method. Starts new Connection with MongoDB. If the process.env.DEV === True this method will try to connect with your local database. Change the connection constans in Config Database Module
Returns:
object - MongoDB Connection.