add .exec() to mongo queries
This commit is contained in:
parent
ade4f62ef8
commit
b6a92325a7
@ -55,17 +55,19 @@ export class IndustryChangeApplicationService {
|
||||
throw new NotFoundException('Resident not found');
|
||||
}
|
||||
|
||||
return this.applicationModel.find({
|
||||
return this.applicationModel
|
||||
.find({
|
||||
residentSub: options.residentSub,
|
||||
status: {
|
||||
$in: options.statuses || Object.values(ApplicationStatus),
|
||||
},
|
||||
objectStatus: ObjectStatus.CURRENT,
|
||||
});
|
||||
})
|
||||
.exec();
|
||||
}
|
||||
|
||||
async getById(id: string) {
|
||||
const find = await this.applicationModel.findById(id);
|
||||
const find = await this.applicationModel.findById(id).exec();
|
||||
if (!find) {
|
||||
throw new NotFoundException('The application was not found');
|
||||
}
|
||||
@ -151,7 +153,7 @@ export class IndustryChangeApplicationService {
|
||||
}
|
||||
|
||||
async markDeleted(id: string, token: string) {
|
||||
const findApplication = await this.applicationModel.findById(id);
|
||||
const findApplication = await this.applicationModel.findById(id).exec();
|
||||
|
||||
if (!findApplication) {
|
||||
throw new NotFoundException('Application was not found');
|
||||
|
@ -16,10 +16,12 @@ export class ResidentService {
|
||||
}
|
||||
|
||||
public async getResidentBySub(sub: string): Promise<Resident> {
|
||||
return this.residentModel.findOne({ sub });
|
||||
return this.residentModel.findOne({ sub }).exec();
|
||||
}
|
||||
|
||||
public async save(resident: Partial<Resident>): Promise<Resident> {
|
||||
return this.residentModel.findOneAndUpdate({ sub: resident.sub }, resident);
|
||||
return this.residentModel
|
||||
.findOneAndUpdate({ sub: resident.sub }, resident)
|
||||
.exec();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user