I have some data here:
{ _id: 1, url: "romeojuliet" }
{ _id: 2, url: "romeojuliet2" }
{ _id: 3, url: "oromeojuliet" }
This is my current code
exports.searchUrl = function(req, res) {
var url = req.body.url;
Content.find({ 'url': /^url/i}, function(err, doc) {
var returnValue = doc;
if(doc == null) {
returnValue = {};
}
if (err) return next(err)
return res.send(returnValue);
});
};
Expect that req.body.url
is "romeojuliet"
From that code I actually want to show all the data that contains "romeojuliet%",
in that case the _id 1 and 2 will appear.
Is it possible?