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

Convert legacy projection syntax before applying #145

Merged
merged 2 commits into from
Jan 4, 2017

Conversation

alcaeus
Copy link
Owner

@alcaeus alcaeus commented Jan 4, 2017

Fixes #144.

This was never properly documented in the driver, but has been there for quite some time. Digging into the code, I found the following comment (source):

Legacy handling where the projection is an array of field names to be included (e.g. ['x', 'y', 'z'] is converted to {'x': 1, 'y': 1, 'z': 1}).
This behavior dates back to 0.9.4, but there is no record of it in the extension's documentation. It should be deprecated/removed in the future, as it conflicts with supporting some legitimate projections (PHP-1056).

Thus, it's sensible to apply the same conversion whenever a projection is applied to a query.

Apparently, the output of `validate` changed somewhere down the line, so we just skip a couple of checks.
@alcaeus alcaeus added the bug label Jan 4, 2017
@alcaeus alcaeus added this to the 1.0.8 milestone Jan 4, 2017
@alcaeus alcaeus changed the base branch from master to 1.0.x January 4, 2017 09:51
@alcaeus alcaeus merged commit 20995f5 into 1.0.x Jan 4, 2017
@alcaeus alcaeus deleted the fix-gridfs-find-projection branch January 4, 2017 09:51
@EmmanuelVella
Copy link

Just tested your fix, it's working great, thank you !

@alcaeus
Copy link
Owner Author

alcaeus commented Jan 4, 2017

Thanks for the feedback, good to know!

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

Successfully merging this pull request may close these issues.

2 participants