我试图在多个阶段对数据进行分组。
目前我的查询如下所示:
db.captions.aggregate([
{$project: {
"videoId": "$videoId",
"plainText": "$plainText",
"Group1": {$cond: {if: {$eq: ["plainText", {"$regex": /leave\sa\scomment/i}]},
then: "Yes", else: "No"}}}}
])
Run Code Online (Sandbox Code Playgroud)
我不确定是否真的可以在聚合阶段的 $cond 中使用 $regex 运算符。我非常感谢您的帮助!
提前致谢