Cleanup mongodb authentication

Authenticate to the database before getting a reference to the collection.

AN-159 #review