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 #1404] aggregate options ignored in where #1403

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
Next Next commit
Fix aggregate options ignored in where
If aggregate options are passed to where, they are saved to the criteria
object from normalize.criteria(criteria) however only criteria.where is
saved to _criteria.where, options saved to criteria object is ignored.
dinana committed Oct 27, 2016
commit eb010aedea44e414fbc4c853837beaeefa463b98
16 changes: 9 additions & 7 deletions lib/waterline/query/deferred.js
Original file line number Diff line number Diff line change
@@ -338,17 +338,19 @@ Deferred.prototype.where = function(criteria) {
this._criteria = false;
}

if (!criteria || !criteria.where) return this;
if (!criteria /*|| !criteria.where*/) return this;

if (!this._criteria) this._criteria = {};
var where = this._criteria.where || {};
// var where = this._criteria.where || {};

// Merge with existing WHERE clause
Object.keys(criteria.where).forEach(function(key) {
where[key] = criteria.where[key];
});
// // Merge with existing WHERE clause
// Object.keys(criteria.where).forEach(function(key) {
// where[key] = criteria.where[key];
// });

// this._criteria.where = where;

this._criteria.where = where;
_.extend(this._criteria, criteria);

return this;
};