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

Projection: Explicitly defined inclusions faulty #722

Closed
kenmaca opened this issue Sep 29, 2015 · 4 comments
Closed

Projection: Explicitly defined inclusions faulty #722

kenmaca opened this issue Sep 29, 2015 · 4 comments
Labels
Milestone

Comments

@kenmaca
Copy link

kenmaca commented Sep 29, 2015

I'm trying to make use of projections on one of my endpoints named user to only show usernames:

config = {
    'item_title': 'user',
    'public_methods': ['POST'],
    'public_item_methods': [],
    'datasource': {
        'projection': {
            'username': 1
        }
    },
    'allowed_filters': [],
    'extra_response_fields': ['username'],
    'item_methods': ['GET', 'PATCH', 'DELETE'],
    'resource_methods': ['GET', 'POST'],
    'schema': schema
}

This doesn't work and it exposes all fields as if I didn't specify the projection. If I change 'username': 0, then for some reason it'll properly exclude just username. I thought a inclusion projection only exposed the fields that you define and hides the others? Strangely, if I pass the projection via URL (users?projection={"username": 1}) -- inclusion works as intended.

@kenmaca
Copy link
Author

kenmaca commented Sep 29, 2015

I should also mention that inclusion works fine on an endpoint that uses another collection via source.

@nicolaiarocci nicolaiarocci added this to the 0.6.1 milestone Oct 1, 2015
@nicolaiarocci
Copy link
Member

thanks for reporting!

@nicolaiarocci
Copy link
Member

Should be fixed now!

@kenmaca
Copy link
Author

kenmaca commented Oct 3, 2015

Thanks!

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

No branches or pull requests

2 participants