I have the following query
db.Profiles.find({ "$text" : { "$search" : "vk" } })
It gives me the following result
{
"_id" : ObjectId("55e999a5bd1f3926586799bb"),
"created" : ISODate("2015-09-04T13:16:21.555Z"),
"userId" : 4790,
"email" : "[email protected]",
"firstName" : "",
"lastName" : "",
"phoneNumber" : "",
"isUnsubscribed" : false,
"isAboveLimit" : true,
"status" : 0,
"userAgent" : 0,
"isDeleted" : false,
"p2l" : [
{
"listId" : 31613,
"status" : 25,
"subscriptionDate" : ISODate("2015-09-17T14:04:33.660Z")
}
],
"countryId" : 0,
"cf" : []
}
But the following does not
db.Profiles.find({ "$text" : { "$search" : "v" }})
There are not results.
From the documentation:
The
$text
operator matches on the complete stemmed word. So if a document field contains the word blueberry, a search on the term blue will not match. However, blueberry or blueberries will match.
If you want to find the records that contain a v
in the email
field, you can do a $regex
match:
db.Profiles.find({ "email" : { "$regex" : /v/ } })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With