Search in text returns nil

MongoDB Enterprise > db.demotext.find()
{ “_id” : ObjectId(“5ce1ab39f2968c5cee751e9e”), “statement” : “MongoDB is the best” }
{ “_id” : ObjectId(“5ce1ab42f2968c5cee751e9f”), “statement” : “MongoDB is the worst” }
{ “_id” : ObjectId(“5ce1b2b4f2968c5cee751ea0”), “statement” : “MongoDB is the NOSQL database” }
MongoDB Enterprise > db.demotext.find({$text:{$search:“mongodb”}}).count()
MongoDB Enterprise > db.demotext.find({$text:{$search:“the”}}).count()

Can you explain why it returns 0. I would expect 3. I’m a bit lost.

My guess is that the is a common article and is not indexed.


As @steevej-1495 says, the text indexing system eliminates language-specific stop words, such as ‘the’. See the documentation here for more information,