Searching is not working on relational data

HI Team,

We are facing an issue with search from the provided search box on the relational fields.

below is the listing of data and apply filter but the data is not showing.

List of data.

Applied filter with no response.

Below are the model definition:

const schema = Mongoose.Schema({
    'talent': { type: Mongoose.Schema.Types.ObjectId, ref: 'users' },
    'follower': { type: Mongoose.Schema.Types.ObjectId, ref: 'users' },
    'created_at': Date,
    'updated_at': Date,
  }, {
    timestamps: false,

Express: ~4.17.1
forest-express-mongoose: ^7.0.0
mongoose: 5.8.2


Hello @sourabht,

Thanks for your feedback.

Could you please activate the logs with mongoose.set('debug', true); and spot the request that is made when you apply this filter?

Hi @GuillaumeGautreau ,

I tried as you suggested please find below log.

GET /forest/gigfollowers?timezone=Asia%2FCalcutta&fields%5Bfollower%5D=email&fields%5Bgig%5D=title&fields%5Bgigfollowers%5D=follower%2Cgig%2Cupdated_at%2Ccreated_at&page%5Bnumber%5D=1&page%5Bsize%5D=15& 304 - - 2.758 ms
Mongoose: gigfollowers.aggregate([ { '$match': { '$and': [ {} ] } }, { '$group': { _id: null, count: { '$sum': 1 } } }], {})
GET /forest/gigfollowers/count?fields%5Bgigfollowers%5D=follower%2Cgig%2Cupdated_at%2Ccreated_at&fields%5Bfollower%5D=email&fields%5Bgig%5D=title& 304 - - 16.408 ms


It looks like the URL in your log does not match the search you’re showing in your screen capture. Are you sure you did the same search in both cases?

For your information, I tried to replicate your issue on my side, but for now I could not. I created a relationship just as you did, but the filter is working as expected.

Yes, apply a filter is working.

but when I enter something on the below box then the search is not working.


You are right, the search feature does not search into related data. This is done because of performance reasons, in some cases, searching in all related collections can be very time consuming and we cannot implement this in all cases.

If it’s important for you, it might be possible to override the route that is used to search for values.

I’m adding this suggestion to our product board, that lists all improvement suggestions.

Thanks for detailed information @GuillaumeGautreau .

@sourabht can you try to click on “Try an extended search” at the bottom after doing the search?

Let me know if that helps

Hi @louis ,

I tried with “Try an extended search” getting the below result.


I’m having the same result on my test project. I’m investigating this problem. I’ll get back to you when I have more info.

It seems that the extended search works only on nested fields on forest-express-mongoose, but not on relationships.

I’m creating an issue on our side to see if we can add it.

Thank you @GuillaumeGautreau .