ŞükSefHam
ŞükSefHam

Reputation: 167

Similar search text with mongoose(like sql we can use like query)

I try Similar Search text with mongoose;but i cant get result like this:

    var x="ol"//in database value is "olala"
    topic.find( { $text: { $search:x } }).exec(function(err,ss){
                     if(ss){console.log(ss)}

                 })

if i try like this i can get result.If x same as database value i can get result.In php- we use %(modulus) for Similar Search:

var x="olala"
    topic.find( { $text: { $search:x } }).exec(function(err,ss){
                     if(ss){console.log(ss)}

                 })

Upvotes: 0

Views: 72

Answers (1)

Mohit Mutha
Mohit Mutha

Reputation: 3001

Unfortunately the only other way is regex https://docs.mongodb.com/manual/reference/operator/query/regex/

Upvotes: 1

Related Questions