Skip to content
This repository has been archived by the owner on Mar 13, 2020. It is now read-only.

Commit

Permalink
Merge pull request #16 from DoctorVoid/fix-irrelevant-entities
Browse files Browse the repository at this point in the history
fix: query deleted irrelevant entities too
  • Loading branch information
yarinvak authored Jun 3, 2019
2 parents b2b251c + e083b5b commit 38eefa9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/schema-helpers/query-with-irrelevant-wrapper.ts
Original file line number Diff line number Diff line change
@@ -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<InnerModelType<any>>,
Expand All @@ -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));
Expand Down

0 comments on commit 38eefa9

Please sign in to comment.