I'm trying to find the best way to authenticate users against my server and how to handle the connection pool. Since I'm not sure if it is better to create a connection per new connection so as to authenticate a new user or to have connections already open and serve from them. If it is the second case, I wouldn't know how to handle the authentication process properly. I'd really appreciate an advice this is my first time struggling with user authentication and connection pooling.
My idea is to authenticate users against mongodb users collection (created for the database I want them to use). My architecture for now is a web client that after authenticating users sends messages with a json web token to a rest api (in node obviously w/ restify) that persists its data in Mongo (users included there).
Thanks in advance!