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
:
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]