Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with Mongo transactions #190

Open
carstenblt opened this issue Aug 18, 2024 · 0 comments
Open

Not working with Mongo transactions #190

carstenblt opened this issue Aug 18, 2024 · 0 comments

Comments

@carstenblt
Copy link

OK, this took me a while.

In payload.config.ts I needed to set

db: mongooseAdapter({
  url: process.env.DATABASE_URI,
  transactionOptions: false // <-- this
})

to get it working. Otherwise

  • creating a new document fails in the findOrCreateArticleDirectory method of filesApiByDocument called by the afterChange hook because the document does not yet exist in the DB, when executing
this.payload.update({
  collection: this.collectionSlug,
  id: this.document.id,
  data: {
    crowdinArticleDirectory,
 },
});
  • updating an existing document fails with MongoServerError: Caused by :: Write conflict during plan execution and yielding is disabled. :: Please retry your operation or multi-document transaction. Didn't debug this yet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant