I have a Mongo database which I am entering through Mongoose and node.js. There is a series of items in the database called machine
. Each machine has an area that is stored in the form of string
, but represents a regular expression. Want to take a given string (provided by the user) and look for any possible matches in the database against all regular expressions. I know that you can search the database with something like this:
Machines. Search ({subject: {$ regex: hi}}) Exec (work (error, result) {/ stuff for results}}}}
But how can I do this?
You can do this $ where
:
machines.Find ({$ where : 'New RegExp (this.subject) .test (' + '"' + + string + '") === true'})
also Hi Gregg
< / Div>
No comments:
Post a Comment