Search code examples
mongodbprisma

Allow any field in Prisma


How do I allow any field to be added in Prisma? What I mean by this is something like [key: String]: String in TypeScript. I use mongoDB as a database.


Solution

  • Prisma doesn't allow passing objects to query methods (e.g. CRUD Methods) with additional fields. You would need to filter out the object with fields which are recognized by Prisma before passing it to query methods.

    Here's the official Feature Request: Don't throw error when passing object with additional fields which discusses allowing arbitrary fields to prisma.