Fix "access" hook for unoptimized "near" queries
Before this change, when an "access" hook modified the "query" object, the "near" condition from the original "query" object were still applied. As a result, the query can end up being more restrictive and return only a subset of models that should have matched the conditions. With this change in place, after "access" hook observers are invoked, we update the "near" condition using the "query" object provided by hook observers. Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
This commit is contained in:
parent
344441d48d
commit
aa20180c4f
|
@ -1535,7 +1535,7 @@ DataAccessObject.find = function find(query, options, cb) {
|
|||
|
||||
this.applyScope(query);
|
||||
|
||||
const near = query && geo.nearFilter(query.where);
|
||||
let near = query && geo.nearFilter(query.where);
|
||||
const supportsGeo = !!connector.buildNearFilter;
|
||||
let geoQueryObject;
|
||||
|
||||
|
@ -1597,6 +1597,7 @@ DataAccessObject.find = function find(query, options, cb) {
|
|||
|
||||
function queryGeo(query) {
|
||||
geoQueryObject = query;
|
||||
near = query && geo.nearFilter(query.where);
|
||||
invokeConnectorMethod(connector, 'all', self, [{}], options, geoCallback);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue