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

Add lang fields to field projection #485

Merged
merged 2 commits into from Aug 28, 2018

Conversation

Projects
None yet
2 participants
@eduardoboucas
Copy link
Member

eduardoboucas commented Aug 28, 2018

With multi-lang support, additional care is required when processing field projections. Imagine the following request:

/version/db/collection?fields={"title":1}&lang=pt

We are requesting the Portuguese translation of this document. The Portuguese version of the title field, for example, would be stored as title:pt, but our field projection is excluding that field from the result. Currently, API detects this situation and adds all language variation fields to the field projection when there is a lang parameter in the request.

However, applications like Publish may need to have an overview of the document, including all the language variations, without specifying a lang parameter in the request. As a result, this PR changes the behaviour above so that language variations are always added to field projections – i.e. when a field projection excludes a field, all its language variations will be excluded as well, and when a field projection includes a field, all its language variations will be included as well.

The i18nv1 feature code has been added.

@eduardoboucas eduardoboucas requested a review from jimlambie Aug 28, 2018

@eduardoboucas eduardoboucas merged commit 8107f53 into develop Aug 28, 2018

3 of 4 checks passed

coverage/coveralls Coverage decreased (-0.008%) to 89.837%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
security/snyk - package.json (DADI) No manifest changes detected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment