Skip to content

Conversation

flovilmart
Copy link
Contributor

@flovilmart flovilmart commented Dec 6, 2016

When using select() (i.e.: keys) with nested keys a.b parse-server doesn't include by default a which make the call fail (unless you have include('a') specified).

This PR addresses that issue and will simplify the behaviour (and code for the clients).

For ex, calling select a.b.c will not include full objects a and a.b but only the necessary path to resolve correctly the keys clause.

Fixes #3185

this.keys.add('updatedAt');
case 'keys': {
const keys = restOptions.keys.split(',').concat(AlwaysSelectedKeys);
this.keys = Array.from(new Set(keys));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

this.keys.add('objectId');
this.keys.add('createdAt');
this.keys.add('updatedAt');
case 'keys': {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm. { in case, new one on me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done();
})
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

solid test.

@flovilmart flovilmart merged commit fb36dfa into master Dec 6, 2016
@flovilmart flovilmart deleted the fix-#3185 branch December 6, 2016 21:28
Jcarlosjunior pushed a commit to back4app/parse-server that referenced this pull request Dec 13, 2016
* Adds tests that reproduce the issue

* Use values from keys to force include when needed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

select() with nested keys issue
3 participants