听起来您的$redact
内没有$cond
个参数:
db.collection.aggregate([
{ "$redact": {
"$cond": {
"if": <logical condition>
"then": < something like $$KEEP or $$PRUNE or $$DESCEND >,
"else": < something like $$KEEP or $$PRUNE (etc) depending on which is false >
}
}}
])
手册页中所有内容都已链接。