db.clients.aggregate([ { $group: { _id: { companyId: "$companyId", email: { $toLower: "$email" } }, count: { $sum: 1 }, emails: { $addToSet: "$email" } } }, { $match: { count: { $gt: 1 }, $expr: { $gt: [{ $size: "$emails" }, 1] } } } ])