Node js with Mongodb


I just want to know how nodeJs work with mongoDB in a login page.
I’ve worked with many code in google, like ejs, passport etc.its showing a big code for this login page. I am totally new to nodejs and mongodb.
so i want to know how these are connected in login page with a simple code.
(I dont need mongodb connecting code, i need how both can work to do in a login form).

Well it can work just like any other database. You execute the appropriate queries to check whether form data exists, after validation of course, and either allow or deny access.

There are nodejs libraries which handle login sessions for you and might make this process much easier. I suspect you’re not asking how to connect to mongo within node? If so I could show you the function I use in a project.