Skip to content

Minimongo bug with $regex #2817

@fpoirier1

Description

@fpoirier1

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions