How to include url filter parameters in mongoose get call How to include url filter parameters in mongoose get call mongoose mongoose

How to include url filter parameters in mongoose get call


It's very simple, you only need to learn MongoDB in using AND.

For your case, you can use the example below:

If the type is in the same collection, you can use the example below.

const params = req.params;const query = req.query;cheese = cheese.find({ $and: [ params, query ]})

If the type is in a different collection, then you can try to learn aggregation in MongoDB.

That's All.

I hope it's can help you.