changed database access to use a single MongoClient instead of one for each database function invocation