converted login system to mongodb