Question: I have a problem when i query using mongoose.I coding follow this [Mongoose.js: Find user by username LIKE value](https://stackoverflow.com/questions/9824010/mongoose-js-find-user-by-username-like-value). But it return blank.

This my code return blank.

```
 var promise = UserSchema.find({name: /req.params.keyword/ }).limit(5);

```

I tried this return blank seem.

`var n = john; var promise = UserSchema.find({name: /n/ }).limit(5);`

But i tried this is working

```
 var promise = UserSchema.find({name: /john/ }).limit(5);

```

Why I use variable then return blank?

Answer: 
```
 select * from table where abc like %_keyword%

```

in mongo it is

```
  const list = await ProductModel.find({{ pname :{ $regex : '.*'+ _keyword + '.*' }});

```

here `_keyword` can be any text eg. fruit, pen, etc. as i am searching products model.
You can run a regex lookup with dynamic values using `RegExp`:

```js
 var promise = UserSchema.find({name: new RegExp(req.params.keyword, 'i') }).limit(5);

```

Notice the `'i'` option for case insensitivity.