0
I’d like to search where I want only the records where watson is equal to true and node-visited is equal to Bem-vindo
I was doing it this way
db.getCollection('conversations').find({'watson':true},
{    
$project: 
{
    messages: 
    {
        $filter: 
        {  
            input: '$messages',
              as: 'message',
            cond: 
            {
                $eq:['$$message.output.nodes_visited','Bem-vindo']
            } 
        }
    }
}
})
But it did not work and gave the following error
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"
}

I identified the error, the $filter only works with Aggregate
db.getCollection('conversations').aggregate({$match:'watson':true},, but it’s still not filtering right– ALE_ROM