Is it possible to make the create method ignore th...
# orm-help
a
Is it possible to make the create method ignore the values that are not there in the schema.
m
Hey Arun 👋 I guess what you’re looking for is having a JSON field?.They’’re useful when: • You need to store data that does not have a consistent structure • You are importing data from another system and do not want to map that data to Prisma models https://www.prisma.io/docs/concepts/components/prisma-client/working-with-fields/working-with-json-fields
a
Actually, the schema keys are mapped to the front end js state object keys. I want to keep both in consistent with each other at the same want the data property on the `prisma.create`to ignore the extra/additional key values that are not defined in the schema.
m
I don’t think it’s possible because each field in a model maps to a column in the database. What you’re saying (correct me if I’m wrong) is you want to pass extra fields in the
prisma.create()
function, which are not defined in your schema
If you’re going to pass extra/addtional key values you should define them in your prisma schema. If these extra/additional key values are not always the same when you’re using
prisma.create()
, you can either: • add all possible fields to the schema and make them optional, this way you won’t get an error • use a JSON field which allows you to store a flexible JS object