Daan Helsloot
03/30/2022, 3:39 AMfindUnique call compared to a findFirst call? Is there any difference and if so, how big is it?Casey Chow
03/30/2022, 4:08 AMfindUnique guarantees there’s an index it can look at, but the query planner for your DB can always have other plans. findFirst can be more performant if your indices are set up in a way more conducive to the query terms.Daan Helsloot
03/30/2022, 4:14 AMCasey Chow
03/30/2022, 4:49 AMCasey Chow
03/30/2022, 4:49 AMNurul
03/30/2022, 6:59 AMfindUnique uses only unique fields to find a property that will have performance benefits over large data sets, and is strict in using indexed properties.
findFirst is essentially findMany with a take of one and returns the 0 index of the array. It was created to solve people having to return findMany()[0] and write their own catches and checks.Jonathan
03/30/2022, 7:19 AMNurul
03/30/2022, 7:34 AMfindUnique is recommended