MongoDB and fulltext search part of the word -


i need find part of word, if search len shut find words there starting len.

i'm trying use fulltext search in mongodb , working when hit 100% words , not part of words.

have sombardy soluion me issue working?

sample code there working:

db.getcollection('product').find({     '$and' : [{     '$text': {         '$search' : 'lenovo', // match word         '$casesensitive' : false     },     '$text': {         '$search' : 'y50 b50 y700', // synonym prepared         '$casesensitive' : false     }     }] }) 

sample code want same resualt:

db.getcollection('product').find({     '$and' : [{     '$text': {         '$search' : 'len',         '$casesensitive' : false     },     '$text': {         '$search' : 'y50 b50 y700',         '$casesensitive' : false     }     }] }) 

thanks time, , hope can fulltext search in mongodb

if want full text search in mongo should go $regex using query be

db.product.find({name:{$regex:/len/i}}) 

for more can read documentation well. https://docs.mongodb.com/manual/reference/operator/query/regex/


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -