Answer the question
In order to leave comments, you need to log in
Mongodb (Mongoose).find() how to search for non-exact match?
Let's say I need to find in the database all the objects whose property "string" contains part of the desired value, for example, we are looking for all objects whose property "string" is equal to or contains the value of the search string.
Let's say we have the desired phrase: let value = "serg"
and now I need to find all the objects in the "Users" table whose name property contains or is equal to this string: Users.find({name: value});
but with such a search, there is a strict comparison, there are options to achieve something similar ~name.indexof(value)
and if the condition is true, then the object will be included in the output array?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question