From 7a2913023438c48f7787c6b8aae62b7ae8680012 Mon Sep 17 00:00:00 2001 From: Toast Date: Sun, 2 Feb 2025 18:08:53 +0100 Subject: [PATCH] Shows/service: search regex in title AND description --- src/shows/shows.service.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/shows/shows.service.ts b/src/shows/shows.service.ts index dc92c32..5becbcd 100644 --- a/src/shows/shows.service.ts +++ b/src/shows/shows.service.ts @@ -34,7 +34,10 @@ export class ShowsService { async search(name: string) { const regex = new RegExp(name, 'i'); - return this.showModel.find({ title: { $regex: regex } }); + const filter = { + $or: [{ title: { $regex: regex } }, { description: { $regex: regex } }], + }; + return this.showModel.find(filter); } async update(id: string, dto: ShowDto): Promise {