You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MongoDB: Command failed (OperationNotSupportedInTransaction): Cannot run command against the 'admin' database in a transaction. #7967
The default Mongo connection string you get from DigitalOcean's hosted MongoDB offering looks like this: mongodb+srv://doadmin:[email protected]/admin?authSource=admin&replicaSet=db-mongodb-nyc3&tls=true&tlsCAFile=../ca-certificate.crt.
When you try to run a query on that, you get an error message like this:
PrismaClientUnknownRequestError2 [PrismaClientUnknownRequestError]:
Invalid `prisma.user.deleteMany()` invocation:
Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: RawError { code: "unknown", message: "Command failed (OperationNotSupportedInTransaction): Cannot run command against the 'admin' database in a transaction.)" } })
at cb (/home/runner/work/e2e-tests/e2e-tests/databases/mongodb-digitalocean/node_modules/@***/client/runtime/index.js:33904:17)
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
clientVersion: '2.27.0-dev.6'
}
Turns out there is a limitation around default databases like admin for using transactions. We should handle that somehow.
Suggestion: Better error that knows about the system databases and helps you to understand the failure and offers a solution: Change the database name to something that is not a system database and can use transactions.
Activity
matthewmueller commentedon Jul 1, 2021
Planning Notes:
New MongoDB instances come with 4 collections:
Workaround:
Improvements to consider for now
janpio commentedon Feb 17, 2022
Suggestion: Better error that knows about the system databases and helps you to understand the failure and offers a solution: Change the database name to something that is not a system database and can use transactions.
pinchez254 commentedon Apr 7, 2022
creating a separate db with a different name worked for me. Avoid using primary
DBswith reserved names such asadminorroot