Matching a string field with regex

can i use regex to check the value of field in aggregation stages??

I tried to use inside $project stage, but it was not giving expected result.

@Mahesh_56388,

Mostly you have to use accumulator opeerators in $project stage. So, better try you filter expression or operator $regex in match stage and get succeed.

@https://discourse.university.mongodb.com/u/Mahesh_56388

You cannot use the $regex operator – which is a query operator – in the $project stage. Read the documentation here on the appropriate values for the $project stage; as you can see, generalized query operators are not supported. HTH. Good luck.