Help with Prisma schema
Im working on a NextJS project with Prisma and mangoDB
I have an Activity model that has a relationship with Member
when first creating an Activity it dosn't have members only and owner but i still want to set the default value to an empty array.
when I try to do so with a post request and set members: [] to an empty array i get this error:
Argument
members
: Invalid value provided. Expected MemberCreateNestedManyWithoutActivityInput.
will appreciate any help to solve this problem.

4 Replies
show us the code snipped from create
@ranco
At first, Ensure the relation field in Prisma schema is set up correctly
The problem is that it wants to describe a field when it is created, but this is automatically generated by the relation. Just leave out members in the create function and you're done
@ranco
use some code on the backend to add the members[] array to the data you pass to create function, if it has elements, otherwise leave it out completely as @DevPanda suggested
or
in js, for the same thing
if its empty