Hello, quick question i don't found on doc or i'm ...
# orm-help
b
Hello, quick question i don't found on doc or i'm stupid probably second , on prisma request how can i do Something like this : i have 2 condition on where, i check user role and the service
Copy code
try {
    const result = await prisma.cibest_role.findUnique({
      where: {
        name: props.roleName,
        features: {
          service_name: props.featureName,
        },
      },
      select: {
        features: {
          select: {
            service_name: true,
            create: true,
            read: true,
            update: true,
            delete: true,
            icon: { select: { name: true } },
          },
        },
      },
    });
1
n
You are probably looking for findFirst or findMany in case the field with which you are querying doesn’t have unique attribute
b
Yes, i check doc during 30m then i post and i found 2min after XD typical
Copy code
const result = await prisma.cibest_role.findMany({
      where: {
        AND: [
          {
            name: props.roleName,
            AND: {
              features: { some: { service_name: props.featureName } },
            },
          },
        ],
      },
      select: {
        features: {
          select: {
            service_name: true,
            create: true,
            read: true,
            update: true,
            delete: true,
            icon: { select: { name: true } },
          },
        },
      },
    });
maybe more performant later i don't know