Is there a way to force the connection to mongodb to be read-only via connection string? I don't want to have to create a read-only user in every environment to run some tests that I want to make sure don't change the database
Mongodb Force read-only via connection string
Asked Answered
No, privileges are manged by user, not by connection string. However, typically the connection string also contains the user name, so what is your problem? Creating a user is a single command - and dropping the user after your test is no problem either. –
Beem
No, because connection string is interpreted by the client. Access control is enforced by the server.
I feel like this begs the question, why can't the client ask the server to ignore writes, but since it's the reality here you go –
Hereabouts
The client can not send the writes in the first place. Why would someone send writes AND ask to ignore them. –
Peignoir
The someone that authors the connection string and the someone that uses the client are often different people –
Hereabouts
© 2022 - 2024 — McMap. All rights reserved.