payload icon indicating copy to clipboard operation
payload copied to clipboard

DocumentDB: cursur within transaction not supported, rest API 500 error above 101 results

Open mvdve opened this issue 1 year ago • 9 comments

Link to reproduction

No response

Describe the Bug

When calling a rest endpoint with a limit higher then 101 and more then 101 results, DocumentDB throws the following error:

MongoServerError: Feature not supported: cursor within transaction. Try increasing the batchsize

This seems to be causes by a limitation of Documentdb

To Reproduce

  • Add more then 101 items to a collection
  • Open de admin interface and copy a collection view rest api call
  • Up the limit to 102 and the api call will return an 500 error {"errors":[{"message":"Something went wrong."}]}

Payload Version

2.3.1

Adapters and Plugins

@payloadcms/db-mongodb

mvdve avatar Dec 10 '23 16:12 mvdve

Sorry for the delay. You might consider using the new db: mongooseAdapter( { transactionOptions: false } ) option which disables the use of transactions until this is sorted out.

DanRibbens avatar Dec 23 '23 20:12 DanRibbens

We are having the same problem. Any possible solution that doesn't require disabling transactions?

franciscolourenco avatar Jun 12 '24 13:06 franciscolourenco

@DanRibbens or, is there a way to disable transactions only in a specific (local or REST) API call? Our current workaround would be to use a custom endpoint which fetches all documents using the db adapter in order to not use a transaction, but this way we still need to deal with authorization.

franciscolourenco avatar Jun 17 '24 18:06 franciscolourenco