Skip to content

Aggregation query parameter does not replace keys in the lists #1025

@yjcrocks

Description

@yjcrocks

I was working on an aggregation endpoint:

things_recommended = {
    'url': 'things/recommended/',
    'datasource': {
        'source': 'things',
        'aggregation': {
            'pipeline': [
                {"$match": {"$or": [{"family": "$family_id"}, {"is_shared": True}]}},
                {"$addFields": {
                    "recommended_for_me":
                    {"$setIsSubset":[["$user_id"], "$recommended_to"]}
                }},
                {"$sort": SON([("recommended_for_me", -1), ("happened", -1)])}
            ]
        }
    }
}

However, I found that $family_id and $user_id are not getting replaced since the code only covers the case of a pure dictionary without lists.

See:

if isinstance(st_value, dict):

I'm new to Eve, so I'm not sure that what I found worth an error report. Though it took me quite a time to debug.

Best regards,
Youngjae

PS, Eve is AWESOME.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions