added array filter option

This commit is contained in:
2025-05-03 18:13:31 +05:30
parent 5800069e6b
commit dbc82f53a3
9 changed files with 202 additions and 174 deletions

View File

@@ -42,7 +42,7 @@ export async function listOrgs(params: PageQueryParams, tenantId: string) {
const filterObj = getFilterObject(params);
const orgs = await orgModel.aggregate([
{ $match: { $and: [{ tenantId: tenantId }, { ...filterObj }] } },
{ $match: { $and: [{ tenantId: tenantId }, ...filterObj] } },
{
$facet: {
metadata: [{ $count: "count" }],
@@ -130,7 +130,7 @@ export async function searchOrgs(params: PageQueryParams, tenantId: string) {
const regex = new RegExp(params.searchToken, "i");
const orgs = await orgModel.aggregate([
{ $match: { $and: [{ tenantId: tenantId }, { ...filterObj }] } },
{ $match: { $and: [{ tenantId: tenantId }, ...filterObj] } },
{
$match: {
$or: [{ name: { $regex: regex } }, { domain: { $regex: regex } }],