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

Filtering on embedded document fields is not working #1460

Open
draghuram opened this issue Nov 24, 2021 · 1 comment
Open

Filtering on embedded document fields is not working #1460

draghuram opened this issue Nov 24, 2021 · 1 comment

Comments

@draghuram
Copy link
Contributor

Expected Behavior

I defined two resources "people" and "countries" with "people" containing a "data_relation' field of "countries" resource. When I query people as follows, the response doesn't contain any resources even though there should be some satisfying the criteria.

settings = {
    'RESOURCE_METHODS': ['GET', 'POST'],
    'ITEM_METHODS': ['GET', 'PATCH', 'DELETE'],
    'DOMAIN': {
        'people': {
            "schema": {
                "name": {
                    "type": "string"
                },
                "country": {
                    'required': True,
                    'type': 'objectid',
                    'data_relation': {
                        'resource': 'countries',
                        'field': '_id',
                        'embeddable': True
                    },
                }
            }
        },
        'countries': {
            "schema": {
                "name": {
                    "type": "string"
                },
            }
        }
    }
}

$ curl  'http://localhost:5000/people?where=\{"country.name":"US"\}'

Environment

  • Python version: 3.8
  • Eve version: Tested with latest release as well as master.
@draghuram
Copy link
Contributor Author

draghuram commented Nov 24, 2021

The documentation at
https://docs.python-eve.org/en/stable/features.html#filtering
explicitly mentions that filtering on embedded documents is possible. I can debug this further and provide a fix (if required) so any pointers to the relevant code are appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant