-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Closed
Description
Hello,
I have a project where the user can search his products using a search field. I'm using a Regex to query the products by name. There seems to be a bug for products with the same name. There is only one returned. My helper function looks like this :
products : function(){
var query = Session.get('productsList.query');
if(!query || query.length < 2)
return Products.find();
var regex = new RegExp(query, 'gi');
return Products.find({name : {$regex : regex}});
},
Here is the reproduction info :
I tried using the full name without the regex and it returns all the corresponding products. Also, the regex works fine in MongoDB.
Metadata
Metadata
Assignees
Labels
No labels