Skip to content

Bug : Query an Array attribute with an array of values does not work #2838

@superseby2

Description

@superseby2

👟 Reproduction steps

I am trying to query a Collection where one attribute is an Array of string

Trying this syntax fails to retrieve anything (and it feels normal)

database.list_documents('collection',                                                                       
       [                                                                                                               
           Query.equal("array_attribute, ["value1","value2"])                             
       ]                                                                                                               
))

Trying this syntax fails also while it feels like it could work ;)

database.list_documents('collection',                                                                       
       [                                                                                                               
           Query.equal("array_attribute, '["value1","value2"]')                             
       ]                                                                                                               
))

What I am trying to do is basically an "Array IN Array" comparison. Going the "equal" way seems hackish but I thought as the attribute is stored in a String it might work (and could be a work-around until a proprer "in" or "contains" operator exists. ?)

My only other option to make this work is use a function to "explode" the values contained in array_attribute in a new collection and then I can do a OR comparaison. It works but is not as straighforward + it generates a big collection.

👍 Expected behavior

some content is being retrieved

👎 Actual Behavior

Nothing is retrieved.

🎲 Appwrite version

Version 0.12.x

💻 Operating system

Linux

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingproduct / databasesFixes and upgrades for the Appwrite Database.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions