P
Prisma4d ago
Nick

New to Prisma, can I not rely on the order of the array when creating nested records?

So referencing organiser.events[0] doesn't seem to refer to Event 1?
const organiser = await prisma.organiser.create({
data: {
id: "kp_cb03a5581e674879b5940cbb5f697575",
firstName: "firstName",
lastName: "lastName",
events: {
create: [{
name: "Event 1",
startOn: new Date("2024-12-15T17:00:00Z"),
description: "Description 1",
status: "live",
address: {
create: {
line1: "456 Snow Avenue",
city: "Manchester",
postcode: "M1 1BB",
},
},
},
{//... more events}
],
},
},
include: {
events: true,
},
});



prisma.rSVP.create({
data: {
attendeeId: attendees[0].id,
eventId: organiser.events[0].id,
status: "going",
},
}),
const organiser = await prisma.organiser.create({
data: {
id: "kp_cb03a5581e674879b5940cbb5f697575",
firstName: "firstName",
lastName: "lastName",
events: {
create: [{
name: "Event 1",
startOn: new Date("2024-12-15T17:00:00Z"),
description: "Description 1",
status: "live",
address: {
create: {
line1: "456 Snow Avenue",
city: "Manchester",
postcode: "M1 1BB",
},
},
},
{//... more events}
],
},
},
include: {
events: true,
},
});



prisma.rSVP.create({
data: {
attendeeId: attendees[0].id,
eventId: organiser.events[0].id,
status: "going",
},
}),
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server