Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Eve - Query Embedded Data Relation

Tags:

python

eve

I have the following resource defined:

item = {
    'wrapper': {
        'type': 'dict',
        'schema': {
            'element': {
                'type': 'objectid',
                'data_relation': {
                    'resource': 'code',
                    'field': '_id',
                    'embeddable': True,
                },
            },
        },
    },
}

When I try to query using the objectid, I get empty list.

http://127.0.0.1:5000/item?where={"wrapper.element":"5834987589b0dc353b72c27d"}

5834987589b0dc353b72c27d is the valid _id for the element.

If I move the data relation out of the embedded document I can query it as expected

Is there anyway to do this with an embedded data relation?

like image 330
fullerja Avatar asked Nov 23 '16 16:11

fullerja


1 Answers

I have just tested with eve==0.7.1 and it works as expected by filtering with ?where={"wrapper.element" : "<your_objectid>"}, as you said.

like image 154
gcw Avatar answered Nov 15 '22 01:11

gcw