Can wildcard characters be used in strings for filtering/searching documents?

eg: Say I want to search for a value of field name: “Micheal Jackson” the following does not work, {“name”:"* Jackson"}, the * being a wildcard character. Is there a possibility to do such type of search?

@An_19003,

You can do this, but not with the normal filters in the find(). For this you have use regular expression syntax. Go through the link for more info:
https://docs.mongodb.com/manual/reference/operator/query/regex/

1 Like