Skip to content
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
4 changes: 3 additions & 1 deletion src/Controllers/DatabaseController.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
}
Expand Down