Error Unsupported projection option: $ project "code": 2, "codeName": "BadValue"

0

I would like to do a search where I want only the records where watson is equal to true and node-visited is equal to Bem-vindo

Iwasdoingitthisway

db.getCollection('conversations').find({'watson':true},{$project:{messages:{$filter:{input:'$messages',as:'message',cond:{$eq:['$$message.output.nodes_visited','Bem-vindo']}}}}})

Butitdidnotworkandgavethefollowingerror

Error:error:{"ok" : 0,
"errmsg" : "Unsupported projection option: $project: { messages: { $filter: { input: \"$messages\", as: \"message\", cond: { $eq: [ \"$$message.output.nodes_visited\", undefined ] } } } }",
"code" : 2,
"codeName" : "BadValue"
}
    
asked by anonymous 07.03.2018 / 14:36

1 answer

0

I have identified the error, $ filter only works with aggregate db.getCollection('conversations').aggregate({$match:'watson':true} , but it is not filtering right yet

    
07.03.2018 / 19:30