need help, how do I search `findMany` where the en...
# orm-help
w
need help, how do I search
findMany
where the entity is not referenced by any other entity. I have a model called RenewalStorage that is a pivot table between Renewal <-> Storage models, I want to find Storage that is not referenced in any RenewalStorage
1
k
IDK I get you correctly or not BTW I guess you need to query against fields which are null, If that's the case do this:
Copy code
await this.prisma.tableName.findMany({
  where: { 
    fieldName: {
      equals: null
    }
  }
})
w
found a janky solution that works, I am using:
Copy code
findMany({
where: {relation: {none: {id: {gt: -1}}}
})
it finds any relation that has an id greater than -1 which is impossible to satisfy if you have any relation because the id will always be a positive number.