when running `$transaction` I would like to get th...
# orm-help
a
when running
$transaction
I would like to get the locations that were created but Prisma only returns the main object that was created and not the nested ones
Copy code
export default {
  create: async (prisma, customers) => {
    const maincontractors = allData.map((data) => {
      const newData = {
        ...data,
        customers: {
          connect: customers
            .filter((customer) => data.customers.includes(customer.name))
            .map((customer) => ({ id: customer.id })),
        },
        locations: {
          create: maincontractorLocationData.get(data.name),
        },
      };

      return prisma.maincontractor.create({ data: newData });
    });

    return prisma.$transaction(maincontractors);
  },
};
Is there a way that I can retrieve the
location
that were created?
r
@Angelo 👋 You need to specify
include
in this statement:
Copy code
return prisma.maincontractor.create({ data: newData });
as mentioned here with the name of your relation.
✅ 1