Ralf Vogler
02/11/2021, 3:38 PMRyan
02/12/2021, 7:41 AMRalf Vogler
02/12/2021, 8:36 AMRyan
02/12/2021, 8:37 AMRyan
02/12/2021, 11:43 AMawait prisma.todo.findMany({
include: {
times: {
where: { end: null },
select: { start: true },
orderBy: { start: 'desc' },
take: 1,
},
},
})
Ralf Vogler
02/12/2021, 11:56 AMoffset
to limit
. Does it need to go through all the results or is it O(1)?Ryan
02/12/2021, 11:58 AMRalf Vogler
02/12/2021, 1:40 PMskip
does not scale, not take
.Ryan
02/12/2021, 1:42 PMtake: 1
is just limit 1
under the hood. So the above query should be fine for your use case.Ralf Vogler
02/12/2021, 1:54 PMtimes
as well.Ryan
02/12/2021, 1:58 PMbut it does not allow include allÂI didn’t get this point. as well.times
Ralf Vogler
02/16/2021, 2:07 PM