How to match words in a string field without using $text by using mongodb aggregation framework?

“_id”: “abc”,
“title” : “Product Based Companies”
“_id”: “abcd”,
“title” : “Service Based Companies”

I want to extract the documents which are using product in title field using Mongodb aggregation framework, dont want to use $text operator ?


While this isn’t directly related to the course materials, and so I don’t usually answer questions like this, I would suggest using $regex, which is documented here

This is exactly related to the course material. Chapter 3 Lab 1 where you ask us to match ‘Won’ and (‘Oscar’ or ‘Oscars’) in the awards field in the aggregation .


If that was what @nikhilece2011 meant, it’s certainly not what he said. As he phrased his question, it is very general and deals with a collection that is not in this course. Frankly, I don’t think he was asking about a specific Lab, but rather was trying to solve a local problem.

@Eric_96074: - You are totally correct, I dont know how @DHz is understanding my questions ?

Although I have resolved my problem.