I have to add partial text Search functionality. Can anyone suggest me how to add partial text search functionality in mongodb using nodejs.
CodePudding user response:
You can use $regex
for partial text search functionality. Which is what I believe you are looking for.
CodePudding user response:
Just to clarify, you're looking for a partial text match in multiple columns?
If I'm understanding you I believe you could use $or
with a $regex
for each field in which you're interested in matching.
{ $or:[
{"field_1": {"$regex": YOUR_SEARCH_STRING} },
{"field_2": {"$regex": YOUR_SEARCH_STRING} }
]}
I'm new to StackOverflow so if this isn't what you're looking for let me know and I can try to answer more specifically.