Small change to how MONGODB_DB_NAME is checked

Before the code would try to get the database reference using APP_NAME and then try to get it again using MONGODB_DB_NAME if it was set.  While this worked it didn't match the intent.  Now the proper name is evaluated first before the code attempt to get a reference.