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

Omit the aggregation stage when its parameter is empty/unset #1209

Closed
zhangtemplar opened this issue Nov 22, 2018 · 3 comments
Closed

Omit the aggregation stage when its parameter is empty/unset #1209

zhangtemplar opened this issue Nov 22, 2018 · 3 comments
Milestone

Comments

@zhangtemplar
Copy link
Contributor

@zhangtemplar zhangtemplar commented Nov 22, 2018

For example, I have such endpoint:

{
    'datasource': {
        'source': 'project',
        'aggregation': {
            'pipeline': [
                {"$match": "$where"},
                {
                    "$lookup": {
                        "from": "user",
                        "localField": "creatorId",
                        "foreignField": "id",
                        "as": "creator",
                    },
                },
                {'$unwind': '$creator'},
                {'$match': "$extraWhere"},
                {"$sort": "$order"},
                {"$project": "$projection"}
            ]
        }
    }
}

Sometimes, I don't have $extraWhere provided. In this case, could eve simply remove this stage from the aggregation pipeline?

@nicolaiarocci
Copy link
Member

@nicolaiarocci nicolaiarocci commented Nov 22, 2018

Yes, would be a nice feature to have.

@zhangtemplar
Copy link
Contributor Author

@zhangtemplar zhangtemplar commented Nov 23, 2018

@zhangtemplar
Copy link
Contributor Author

@zhangtemplar zhangtemplar commented Jan 17, 2019

@nicolaiarocci #1210 is ready.

@nicolaiarocci nicolaiarocci added this to the 0.8.2 milestone Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants