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

Unable to use json field when version is on for page. #11182

Open
krishnasinghdev opened this issue Feb 14, 2025 · 2 comments
Open

Unable to use json field when version is on for page. #11182

krishnasinghdev opened this issue Feb 14, 2025 · 2 comments
Assignees
Labels
db: mongodb @payloadcms/db-mongodb status: verified If an issue has been reproduced

Comments

@krishnasinghdev
Copy link

Describe the Bug

I am trying to use a JSON field for page schemas, where it will be generated by default using the afterChange hook or user can enter the JSON data, but I get a Mongoose validation error when version (draft) mode is on. It says that cast to embed failed. It is working fine when I am removing the page versions mode.

using pnpm version-> 10.4.0

Link to the code that reproduces this issue

https://github.com/krishnasinghdev/bug-report/

Reproduction Steps

Input any json value to the schema field and click on save button.

This is will give error "something went wrong." and below error in terminal.

Image
Image

Which area(s) are affected? (Select all that apply)

area: core

Environment Info

Binaries:
  Node: 22.12.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.23.0
  next: 15.1.5
  @payloadcms/db-mongodb: 3.23.0
  @payloadcms/email-nodemailer: 3.23.0
  @payloadcms/graphql: 3.23.0
  @payloadcms/next/utilities: 3.23.0
  @payloadcms/payload-cloud: 3.23.0
  @payloadcms/richtext-lexical: 3.23.0
  @payloadcms/translations: 3.23.0
  @payloadcms/ui/shared: 3.23.0
  react: 19.0.0
  react-dom: 19.0.0
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Home Single Language
  Available memory (MB): 7853
  Available CPU cores: 8
@krishnasinghdev krishnasinghdev added status: needs-triage Possible bug which hasn't been reproduced yet validate-reproduction labels Feb 14, 2025
@AlessioGr AlessioGr added the db: mongodb @payloadcms/db-mongodb label Feb 14, 2025
@github-actions github-actions bot removed the status: needs-triage Possible bug which hasn't been reproduced yet label Feb 14, 2025
@r1tsuu r1tsuu added the status: verified If an issue has been reproduced label Feb 14, 2025
@r1tsuu
Copy link
Member

r1tsuu commented Feb 14, 2025

This looks like an edge case for fields named "schema" because it's a reserved name somewhere. I'll look into that further, for now if you rename it to something else it should work.

@krishnasinghdev
Copy link
Author

Thanks Sasha, It is working now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
db: mongodb @payloadcms/db-mongodb status: verified If an issue has been reproduced
Projects
None yet
Development

No branches or pull requests

4 participants