MongoDB.live, free & fully virtual. Register Now MongoDB.live, free & fully virtual. Register Now

User authentication per database

Hi, I want to develop a multi-tenant SaaS golang application with tenant per database schema and want to have user authentication per database by leveraging connection pool. I found a similar implementation in java in this link. My question is how to do user authentication per database in Go driver with connection pool? Thanks!

you can check the official documentation

https://docs.mongodb.com/drivers/go

Hi Alessandro,

Thanks for the reply. The sample code in the link is not for my case.
I want to build a SaaS application with “Database per Tenant” approach and I need each tenant to authenticate with different credentials to MongoDB.
I learned MongoDB completely separated the actions of "connect” and “authenticate”, means we could leverage connection pool to create a pool of “blank” connections and then borrow a connection from the pool to do authentication for current tenant.
But I have no idea how to do this by using Go driver?

BR, Kevin