This is my code:
//Connect songs already existing in the DB to this playlist aswell
await prisma.playlist.update({
where: { id: newPlaylist.id },
data: {
songs: {
connect: existingSongs.map((song) => {return { id: song.id }}),
},
},
});```
Getting this output: ```newPlaylist.id fbf037cd-a424-4437-8e8b-e8b3b85cf027 existingSongs [
{ id: '7396bfe1-7e75-4167-9f14-6574341dd6ee' },
{ id: 'fec7d79c-f5d4-442f-8b37-ada35fceef66' },
{ id: '459466cf-53f8-4e08-b506-d3e7647e97a3' },
{ id: 'fa17fb13-b57e-4496-9237-0a81d3aecb30' },
{ id: 'd4495cff-f523-43e7-a8ed-c078fe2ae472' },
{ id: '739447da-e1f3-4e16-8c9e-1a9963dac24e' },
{ id: '242a2638-a944-4732-936f-dd914c6a4556' },
{ id: 'c271dd3a-785f-44e7-a935-19bd44db8d78' },
{ id: '14c16502-704b-477c-a970-f6e8686efac3' }
]
Invalid `prisma.playlist.update()` invocation in
65 //Connect songs already existing in the DB to this playlist aswell
→ 66 await prisma.playlist.update(
The required connected records were not found. Expected 9 records to be connected after connect operation on one-to-many relation 'PlaylistToSongsInPlaylists', found 0.```
Be sure the song already exist. Since you're using a junction table (