From e083b5b1824fe204efd2391dad912068a39da10c Mon Sep 17 00:00:00 2001 From: DoctorVoid Date: Mon, 3 Jun 2019 13:57:31 +0300 Subject: [PATCH] fix: query deleted irrelevant entities too --- src/schema-helpers/query-with-irrelevant-wrapper.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/schema-helpers/query-with-irrelevant-wrapper.ts b/src/schema-helpers/query-with-irrelevant-wrapper.ts index f9d384e..0d638bf 100644 --- a/src/schema-helpers/query-with-irrelevant-wrapper.ts +++ b/src/schema-helpers/query-with-irrelevant-wrapper.ts @@ -1,6 +1,6 @@ -import { QueryIrrelevantResult } from '@enigmatis/utills'; -import { Model } from 'mongoose'; -import { InnerModelType } from '../types'; +import {QueryIrrelevantResult} from '@enigmatis/utills'; +import {Model} from 'mongoose'; +import {InnerModelType} from '../types'; export const QueryWithIrrelevant = async ( model: Model>, @@ -12,10 +12,11 @@ export const QueryWithIrrelevant = async ( } const irrelevant = await model.find( { - _id: { $nin: result.map(x => x._id) }, - dataVersion: { $gt: dataVersion }, + _id: {$nin: result.map(x => x._id)}, + dataVersion: {$gt: dataVersion}, + deleted: {$in: [true, false]} }, - { _id: true }, + {_id: true}, ); return new QueryIrrelevantResult(result, irrelevant.map(x => x._id));