Cleanup mongodb authentication

Authenticate to the database before getting a reference to the
collection.
Merge pull request #1229 from rocha/cleanup-eventtracking-mongo-authentication

Cleanup mongodb authentication