Skip to content

Conversation

carmenlau
Copy link
Contributor

Fix #798, the root cause of the problem is the replace query function in RestQuery will overwrite the $in and $nin field.

@carmenlau carmenlau changed the title Fix replace query overwrite the existing query object. Fix using query.notContainedIn and query.doesNotMatchQuery at the same time, notContainedIn will be ignored problem Mar 3, 2016
@flovilmart
Copy link
Contributor

Could you add tests that exemplify the fix?

@@ -290,7 +298,11 @@ RestQuery.prototype.replaceSelect = function() {
values.push(result[selectValue.key]);
}
delete selectObject['$select'];
selectObject['$in'] = values;
if (Array.isArray(selectObject['$in'])) {
Copy link
Contributor

Choose a reason for hiding this comment

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

you ca simplify with selectObject['$in'] = [].concat(selectObject['$in'] || [], values);

drew-gross added a commit that referenced this pull request Mar 3, 2016
Fix using query.notContainedIn and query.doesNotMatchQuery at the same time, notContainedIn will be ignored problem
@drew-gross drew-gross merged commit 3b4faaa into parse-community:master Mar 3, 2016
@carmenlau carmenlau deleted the query-fix branch March 9, 2016 02:03
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.

4 participants