shell

时间:2015-07-13 12:02:43

标签: mongodb

我在mongo db中进行聚合。我有这个错误

  

$ redact的表达式除了变量&&& KEEP,$$ DESCEND和$$ PRUNE之外不应该返回任何内容,但是返回{if:true}

1 个答案:

答案 0 :(得分:0)

听起来您的$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 >
        }
    }}
])

手册页中所有内容都已链接。