getDb function implemented in database.js