Searching in mongo db using mongoose regex vs. text

Viewed 10946

Can anyone please explain the difference between:

db.collection.find({ $text: { $search: "dog cat" } })

and

Product.find({ "drug": { "$regex": "cols", "$options": "i" } })

When should we go for which one ?

2 Answers
Related