# \[Question\] Filter on array of objects

**URL:** https://forum.weaviate.io/t/question-filter-on-array-of-objects/4020
**Category:** Support
**Tags:** technical
**Created:** [September 8, 2024, 5:58pm UTC](https://forum.weaviate.io/t/question-filter-on-array-of-objects/4020 "2024-09-08T17:58:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Tejas\_Sharma](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/tejas_sharma/32/2086_2.png) [@Tejas\_Sharma](https://forum.weaviate.io/u/Tejas_Sharma)
#### Post date: [September 8, 2024, 5:58pm UTC](https://forum.weaviate.io/t/question-filter-on-array-of-objects/4020/1 "2024-09-08T17:58:38Z")

</div>

I want to query objects with a filter on a property that is an array of objects. Let’s say the property is tags:

[  
{uniqueid: 123, name: ‘tag1’},  
{uniqueid: 456, name: ‘tag2’,  
]

I want to get objects that contain a tag with unique id 456 in its `tags` property. Basically, I want to filter on an array of objects by checking if an object exists in the array and then get those objects that match this criteria.

I checked the documentation, and this didn’t seem currently possible (I might have missed something though). What alternate methods could I try here?

For example, I tried using `ContaintsAny`:

```auto
       tenant_collection = nodes_collection.with_tenant(name)
		
		query_result = tenant_collection.query.fetch_objects(
			filters=Filter.by_property("tags").contains_any([{'name': 'work', 'color': '#D5BA04', 'uniqueid': '14b06e9a-10e1-4255-a2b2-d414ecb27821'}],
			include_vector=True
		)

```

But it throws an error, and I believe this functionality might not exist yet.  
The error thrown anyways is:

`UUID input should be a string, bytes or UUID object [type=uuid_type, input_value={'name': 'work', 'color':...4', 'uniqueid': 'sdfsd'}, input_type=dict]`

---

<div class="post-metadata">

### Author: ![Shahin](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/shahin/32/7944_2.png) [@Shahin](https://forum.weaviate.io/u/Shahin)
#### Post date: [September 9, 2024, 12:12pm UTC](https://forum.weaviate.io/t/question-filter-on-array-of-objects/4020/2 "2024-09-09T12:12:09Z")

</div>

Hey @Tejas_Sharma,

Happy Monday! I hope you’re having a great start to the week!

I understand you’re trying to filter by inside arrays of objects, and I imagine your data looks something like this:

```json
{
  "tags": [
    { "uniqueid": 123, "name": "tag1" },
    { "uniqueid": 456, "name": "tag2" }
  ]
}

```

If you’re attempting to filter based on an entire property rather than the values within it, nested-filters can help:

> **[Filters | Weaviate](https://weaviate.io/developers/weaviate/search/filters#nested-filters)**
>
> Filters let you include, or exclude, particular objects from your result set based on provided conditions.

However, if you’re trying to **filter inside arrays of nested objects** , this feature is currently not supported. I would say open a feature request here:

> **[Build software better, together](https://github.com/weaviate/weaviate/issues/new/choose)**
>
> GitHub is where people build software. More than 100 million people use GitHub to discover, fork, and contribute to over 420 million projects.

As a potential workaround, you might consider flattening your data structure and storing the `uniqueid`s in a separate array for more straightforward filtering.

Let me know if this helps or if you have any other questions!

---

<div class="post-metadata">

### Author: ![Tejas\_Sharma](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.weaviate.io/tejas_sharma/32/2086_2.png) [@Tejas\_Sharma](https://forum.weaviate.io/u/Tejas_Sharma)
#### Post date: [September 9, 2024, 6:00pm UTC](https://forum.weaviate.io/t/question-filter-on-array-of-objects/4020/3 "2024-09-09T18:00:56Z")

</div>

Ah I see Mohamed, I’ll submit a request there and it would indeed be very helpful.

And thanks for the alternate workaround, that’s very smart!
