# Query UID of content relationship within repeatable group

**URL:** <https://community.prismic.io/t/query-uid-of-content-relationship-within-repeatable-group/3401>\
**Category:** Developing with Prismic\
**Created:** [December 31, 2020, 11:48pm UTC](https://community.prismic.io/t/query-uid-of-content-relationship-within-repeatable-group/3401 "2020-12-31T23:48:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![andreww500](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@andreww500](https://community.prismic.io/u/andreww500)\
**Post date:** [December 31, 2020, 11:48pm UTC](https://community.prismic.io/t/query-uid-of-content-relationship-within-repeatable-group/3401/1 "2020-12-31T23:48:47Z")

</div>

Hello,

I have a sidebar containing product categories and a grid of products. When the user selects a particular category, I need to load all of the products in that category.

In my Prismic repository, I have `Category` and `Product` types. `Product` contains a repeatable group of content relationships which link to one or more categories (i.e. 'Featured' and 'Travel'). These categories have a UID (i.e. 'featured') I am therefore trying to query based on this repeatable group as such:

```
const products = await this.$prismic.api.query(
    this.$prismic.predicates.at("my.product.categories.category", category.id) // category.id = 'featured'
)
console.log(products.results)

```

This seems to run without any errors, however `products.results` always contains 0 items.

Is there something I'm doing wrong here? Should it be possible to use this strategy, or is there a better way?

For reference, I'm using Nuxt.js.

Thanks!

---

<div class="post-metadata">

**Author:** ![andreww500](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@andreww500](https://community.prismic.io/u/andreww500)\
**Post date:** [January 1, 2021, 5:41pm UTC](https://community.prismic.io/t/query-uid-of-content-relationship-within-repeatable-group/3401/2 "2021-01-01T17:41:00Z")

</div>

I'm thinking of just adding a `products` repeatable group to each `Category` type. That way I can just query the `Category` UID to get the product `UID`s.

I still feel like there must be a better solution however, so any ideas would be much appreciated.

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [January 4, 2021, 10:02am UTC](https://community.prismic.io/t/query-uid-of-content-relationship-within-repeatable-group/3401/4 "2021-01-04T10:02:04Z")

</div>

Hey @andreww500,

Welcome to the Prismic community, and thanks for posting this question 🙂 🤝

This had me puzzled for a moment. Your query looks totally fine. But I think I see the issue. When you query by a Content Relationship, you need to pass the Document ID, _not_ the UID.

For each result, you have some front matter that looks like this:

```auto
"id": "Xz-ajBAAACQA_P9h",
"uid": "config",
"url": null,
"type": "config",
"href": "https://sam-onbo...",
"tags": [],
"first_publication_date": "2020-08-21T09:57:36+0000",
"last_publication_date": "2020-11-17T14:03:11+0000",
"slugs": [
"config-"
],
"linked_documents": [],
"lang": "en-us",
"alternate_languages": [],

```

It looks like you're using the `UID`, and calling it `ID`, but each document already has a default `ID` property, which is a unique, random string. That is the property you need in order to query by Content Relationship.

Please let me know if that makes sense! And, in any case, let me know if you have more questions.

Best,  
Sam

---

<div class="post-metadata">

**Author:** ![andreww500](https://avatars.discourse-cdn.com/v4/letter/a/b4bc9f/32.png) [@andreww500](https://community.prismic.io/u/andreww500)\
**Post date:** [January 5, 2021, 8:36pm UTC](https://community.prismic.io/t/query-uid-of-content-relationship-within-repeatable-group/3401/5 "2021-01-05T20:36:57Z")

</div>

Thanks for the response @samlittlefair!

For now I've gone with the second method I mentioned which is working great (albeit perhaps not as efficient). I'll revisit your suggestion once I come to refactor it - I was definitely using the `UID`, so I'd imagine that switching to `ID` will indeed resolve the issue.

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [January 6, 2021, 9:52am UTC](https://community.prismic.io/t/query-uid-of-content-relationship-within-repeatable-group/3401/6 "2021-01-06T09:52:30Z")

</div>

Great. Let me know if you have any more questions.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [January 7, 2021, 9:52am UTC](https://community.prismic.io/t/query-uid-of-content-relationship-within-repeatable-group/3401/7 "2021-01-07T09:52:38Z")

</div>

closed on January 7, 2021, 9:52am UTC as resolved,  flag & select 'Something Else' to reopen.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 12:07pm UTC](https://community.prismic.io/t/query-uid-of-content-relationship-within-repeatable-group/3401/8 "2021-12-09T12:07:10Z")

</div>

Opened on December 9, 2021, 12:07pm UTC


