for example I have this model ```model Buyer { i...
# orm-help
d
for example I have this model
Copy code
model Buyer {
  id

  buyersToBuyerGroups    BuyersToBuyerGroups[]
}

model BuyerGroup {
  id

  buyersToBuyerGroups               BuyersToBuyerGroups[]
}

model BuyersToBuyerGroups {
  buyerId
  buyerGroupId

  buyerGroup BuyerGroup @relation(fields: [buyerGroupId], onDelete: Cascade, references: [id])
  buyer      Buyer      @relation(fields: [buyerId], onDelete: Cascade, references: [id])
}
so lets say there is two records inside the
BuyersToBuyerGroups
Copy code
buyerId    buyerGroupId
1          32
1          12
so what I want with this query is I want to fetch all buyer groups where
buyerId
is equal to
x
Copy code
prisma.buyerGroup.findMany({
  where: {
    buyersToBuyerGroups = {
	  every: {
	    buyerId: 1
	  }
	};
  }
})
I expect it to return only 2
buyerGroups
because of the
where
but instead it returns me all rows expect those 2. am I misunderstanding
every
or is this suppose to happen? when i use
some
it works as expected, I only get back 2 records...
r
@Dev__ 👋 You mostly want to use
some
. Some matches one or more records and returns at least those. While every tries to match all and it won’t return anything even if one of them doesn’t match. This example from the docs makes it clear: https://www.prisma.io/docs/concepts/components/prisma-client/relation-queries#relation-filters
👍 1