I want to use regex in addFiels in aggregate with mongodb, but I am not able to do that below is my code which I have tried
$addFields: {slug: {$title: {$regex: '/^[^_s]*$/'}}}
but this is giving mongo error. Please find me solution. My expected output should be
slug: "This-is-my-1st-adventure"
. In my db title: "This is my 1st adventure"