Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// `null`)
$eq: [fieldSize, many ? { $size: { $ifNull: [`$${field}`, []] } } : 1],
},
[`${uniqueField}_none`]: { $eq: [fieldSize, 0] },
[`${uniqueField}_some`]: { $gt: [fieldSize, 0] },
},
},
];
});
return [
relationshipIdTerm && { $match: relationshipIdTerm },
...flatten(relationshipPipelines),
matchTerm && { $match: matchTerm },
{ $addFields: { id: '$_id' } },
excludeFields && excludeFields.length && { $project: defaultObj(excludeFields, 0) },
...postJoinPipeline,
].filter(i => i);
}