Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to search for records containing item(s) in a list property? #343

Closed
Natim opened this issue Dec 16, 2015 · 3 comments
Closed

How to search for records containing item(s) in a list property? #343

Natim opened this issue Dec 16, 2015 · 3 comments

Comments

@Natim
Copy link
Member

Natim commented Dec 16, 2015

Let's say I have the following records:

{
    "data": {
        "title": "My title",
        "tags": ["astronomie", "science", "burundi"]
    }
}

What would be the request to look for all science in burundi?

http://localhost:8000/v1/buckets/wiki/collections/articles/records?tags_contains=science,burundi ?
http://localhost:8000/v1/buckets/wiki/collections/articles/records?tags=science,burundi ?

@almet
Copy link
Member

almet commented Dec 16, 2015

+1 for contains.

@Natim
Copy link
Member Author

Natim commented Dec 22, 2015

Let's go for it then 👍

  • tags_contains=science,burundi

@leplatrem leplatrem changed the title How to search for records containing item(s) is a list property? How to search for records containing item(s) in a list property? May 25, 2016
@Natim
Copy link
Member Author

Natim commented Apr 16, 2018

For the postgresql backend we should use jsonb_array_elements(data->'arrayAttribute') as array_element

Refs: https://stackoverflow.com/a/32360952/186202

Natim pushed a commit that referenced this issue Apr 16, 2018
Natim pushed a commit that referenced this issue Apr 16, 2018
Fixes #343

Co-authored-by: Julien Lebunetel <julien@lebunetel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants