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"
}