Reuben Porter
11/02/2021, 11:49 AMdeleteMany
query where I have two where clauses, with one being an array of ids. For a basic example:
model SurveyPermission {
id
userId
surveyId
}
const userIds = ['1', '2', '3'];
const surveyId = 'survey-id';
delete many from surveyPermissions where surveyId === surveyId && userId === one of userIds array
I thought I could use has
but can't seem to get it working as I think that's just for enums.
Obviously I could do this in a loop and use a single delete but ideally wanted to handle it in a single query .Ryan
11/02/2021, 11:52 AMdeleteMany({
where: {
surveyId: 'id',
userId: { in: userIds }
}
})
Reuben Porter
11/02/2021, 11:53 AMReuben Porter
11/02/2021, 11:54 AMReuben Porter
11/02/2021, 11:54 AMReuben Porter
11/02/2021, 11:55 AMRyan
11/02/2021, 11:56 AMReuben Porter
11/02/2021, 11:56 AMReuben Porter
11/02/2021, 11:56 AMReuben Porter
11/02/2021, 12:00 PMReuben Porter
11/02/2021, 12:00 PMRyan
11/02/2021, 12:10 PM