Skip to content

[Bug]: failed to handle $eq operator if the type of the value is array #93

@hnwyllmm

Description

@hnwyllmm

Describe the bug

scenario:

# insert data
collection.add(ids='id1', document='', metadata='{"category": "AI", "score": 95, "tags": ["ml", "ai"], "version": 1}'

# query data by _collection_get
collection.get(where={"tags": {"$eq": "ml"}})

We expect to get one row but got nothing.

Here we have the same behavior with #83 that we use JSON_EXTRACT to extract the value of the specific key and compare it with the input value (which is "ml").

How to fix?
We can also use JSON_OVERLAP instead of JSON_EXTRACT to handle this issue.

Environment

No

Fast reproduce steps

import pyseekdb

client = pyseekdb.Client()
collection = client.get_or_create_collection('test_eq')
collection.upsert(ids='id1', documents='', metadata='{"category": "AI", "score": 95, "tags": ["ml", "ai"], "version": 1}')
results = collection.get(where={"tags": {"$eq": "ml"}})
print(str(results)) # we expect to get 1 row but got nothing

Expected behavior

No response

Actual behavior

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions