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
7f35e0ff2c
commit
c4ff74a723
|
@ -1536,7 +1536,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;
|
||||
|
||||
if (near) {
|
||||
|
@ -1567,6 +1567,8 @@ DataAccessObject.find = function find(query, options, cb) {
|
|||
}
|
||||
|
||||
function queryGeo(query) {
|
||||
near = query && geo.nearFilter(query.where);
|
||||
|
||||
function geoCallbackWithoutNotify(err, data) {
|
||||
const memory = new Memory();
|
||||
const modelName = self.modelName;
|
||||
|
|
Loading…
Reference in New Issue