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

Fix/3678 overloaded query constraints #3723

Merged
merged 7 commits into from
Apr 23, 2017

Conversation

flovilmart
Copy link
Contributor

@flovilmart flovilmart commented Apr 16, 2017

Fixes #3678

Having 2 constraints on the same key when a pointer is set will yield an odd where constraint:

author: {
  __type: Pointer,
  objectId: "Author",
  $nin: [...]
}

this PR transforms the constraint to:

author: {
  $eq: {
    __type: Pointer,
   objectId: "Author",
  }
  $nin: [...]
}

In order to be correctly processed.

We should also probably investigate why this happens in the 1st place, the JS SDK handles this in a very odd way.

@codecov
Copy link

codecov bot commented Apr 16, 2017

Codecov Report

Merging #3723 into master will decrease coverage by 0.01%.
The diff coverage is 95.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3723      +/-   ##
==========================================
- Coverage   90.22%   90.21%   -0.02%     
==========================================
  Files         114      114              
  Lines        7461     7491      +30     
==========================================
+ Hits         6732     6758      +26     
- Misses        729      733       +4
Impacted Files Coverage Δ
src/RestQuery.js 94.91% <95.45%> (+0.03%) ⬆️
src/Adapters/Auth/meetup.js 84.21% <0%> (-5.27%) ⬇️
...dapters/Storage/Postgres/PostgresStorageAdapter.js 95.17% <0%> (-0.28%) ⬇️
src/RestWrite.js 94.3% <0%> (ø) ⬆️
src/Controllers/SchemaController.js 97.05% <0%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5813fd0...7938be9. Read the comment docs.

@flovilmart flovilmart force-pushed the fix/3678-overloaded-query-constraints branch from 4bbbb8d to b5592ed Compare April 16, 2017 18:26
@flovilmart flovilmart requested a review from acinader April 16, 2017 18:26
src/RestQuery.js Outdated
let hasDirectConstraint = false;
let hasOperatorConstraint = false;
for (const key in constraint) {
if (key.indexOf('$') != 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

!==

@acinader acinader merged commit f7af48d into master Apr 23, 2017
@flovilmart flovilmart deleted the fix/3678-overloaded-query-constraints branch May 13, 2017 15:42
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.

3 participants