working functionality with login data from mongodb database