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

Fixes #1271 #1295

Merged
merged 2 commits into from
Mar 31, 2016
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Improve comments
drew-gross committed Mar 31, 2016

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 73bca3b64ca082cb970ff2dfc9d2e50a5e6c8810
4 changes: 3 additions & 1 deletion src/Controllers/DatabaseController.js
Original file line number Diff line number Diff line change
@@ -504,7 +504,9 @@ DatabaseController.prototype.addInObjectIdsIds = function(ids = null, query) {
idsIntersection = intersect(allIds);
}

// Need to make sure we don't clobber existing $lt or other constraints on objectId
// Need to make sure we don't clobber existing $lt or other constraints on objectId.
// Clobbering $eq, $in and shorthand $eq (query.objectId === 'string') constraints
// is expected though.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

Copy link
Contributor

Choose a reason for hiding this comment

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

@drew-gross @flovilmart
I ran into an issue migrating an app to Parse Server and I'm hoping you can shed some light on this. You can see the failing test I wrote here. On api.parse.com and Parse Server <= 2.2.4 this test passes.

I tracked the problem down to this comment. Should we really be clobbering $eq constraints here or should the test linked above pass? The hacky feeling workaround would be to replace query.equalTo("objectId", cake1.id) with query.containedIn("objectId", [cake1.id]) in my test.

Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

@JeremyPlease I believe the test should pass as the query construction seem to be valid. Do you have an idea for the fix?

Copy link
Contributor

Choose a reason for hiding this comment

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

@flovilmart Check out #2472 and let me know what you think.

if (!('objectId' in query) || typeof query.objectId === 'string') {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we move that up? be tough to follow why it's correct to override when typeof query.objectId === 'string' as it's a case managed on L493.

query.objectId = {};
}