Mongodb是否可以使用聚合$match中的字符串过滤电子邮件?

Mongodb是否可以使用聚合$match中的字符串过滤电子邮件?,mongodb,match,aggregate,Mongodb,Match,Aggregate,我在mongoDb很无聊 可以使用简单的字符串过滤电子邮件,如: const data = db.collection.aggregate( [{ $match: new RegExp('bar','i') }, ... ] data output : [{ email: foo@bar.com }] 或者我们可以使用find方法来包含而不是相等?这可能会有帮助:

我在mongoDb很无聊

可以使用简单的字符串过滤电子邮件,如:

const data = db.collection.aggregate(
[{ 
  $match: new RegExp('bar','i')
}, 
...
]

data output : [{
email: foo@bar.com
}]
或者我们可以使用find方法来包含而不是相等?

这可能会有帮助: