payloadcms / payload

Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
https://payloadcms.com
MIT License
25.77k stars 1.64k forks source link

`db-mongodb`: id parsing issues #8652

Closed Fitch24 closed 3 weeks ago

Fitch24 commented 1 month ago

Link to reproduction

https://github.com/Fitch24/payload/blob/mongodb-id-parsing-issue/test/_community/int.spec.ts

Describe the Bug

db-mongodb adapter produces some bugs when passing non-standard id (non ObjectId values or ObjectId with uppercase symbols) in local/rest (and probably GraphQL) API

To Reproduce

  1. Use collection with relationship field
  2. Add item to collection with relationship field in uppercase (via REST-API for example, because of you can't pass raw id directly in Admin-UI)
  3. Try to query this collection and see that relationship field is not populated

Please see reproduction link for more detailed example

Payload Version

2.30.1

Adapters and Plugins

db-mongodb

DanRibbens commented 1 month ago

~This PR should address your issue: https://github.com/payloadcms/payload/pull/8395/files~

My mistake, that PR is for v3.

It seems we'll have to do some sanitization of relationship IDs to insert them in lowercase format.

github-actions[bot] commented 1 month ago

🚀 This is included in version v3.0.0-beta.114

github-actions[bot] commented 3 weeks ago

This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.