Merge pull request #1742 from strongloop/fix/hooks-with-near-queries-3x

Fix implementation of Operation Hooks for "near" (geo) queries
This commit is contained in:
Miroslav Bajtoš 2019-05-14 16:17:58 +02:00 committed by GitHub
commit 5e3e1198d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -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;

View File

@ -917,6 +917,9 @@ describe('Unoptimized connector', function() {
ds.connector.findOrCreate = false;
ds.connector.upsertWithWhere = false;
// disable native location queries
ds.connector.buildNearFilter = false;
require('./persistence-hooks.suite')(ds, should, {
replaceOrCreateReportsNewInstance: true,
});