So can I get a Product that has a Brand with uid=“0x12345”?
Obviously filtering the brand like below doesn’t work because it returns all Products instead and one of them contains the brand with the 0x12345 uid as well. Instead, I need to get the whole Product that has that brand.
If you have the UID you can just query for it. This is not SQL, you do not need to start with the table/type and filter it further. Instead just start with what you actually want.
{
query(func: uid(0x1234)){
uid
expand(_all_)
}
}
If you want to make sure that the uid is part of a type definition, you can filter for it:
@vnium Thanks for the response. Let me add more context. I don’t have the Product ID. I have only the Brand uid. I need to get the Product that holds the Brand with uid 0x1234. I tried everything that is in the Dgraph documentation. It seems that there is no way to do it with filters. I wonder if I need to do multiple queries here with upsert.