Missing flattened fields in the UI

Given the following setup:

**CollectionA** (collection reference is computedField3)
- field1 (string)
- flattened@@@field2 (string)
- computedField3 (`${field1} ${flattened@@@field2}`)

**CollectionB** (collection reference is computedField4)
- relationToCollectionA (oneToMany native MongoDB reference)

Expected Behaviour

(1) When I go to the list page of collection A, I see computedField3 containing both expected values.
(2) When I go to the list page of collection B, I see relationToCollectionA containing both expected values.

Actual behaviour

Case (1) works. In the case of (2), the value for flattened@@@field2 is missing.

Failure Logs

No logs

Context

  • Project name: jurata
  • Team name: jurata
  • Environment name: all
  • Agent (forest package) name & version: 1.35.16
  • Database type: mongodb
  • Recent changes made on your end if any: None specifically

Hello @David_Roegiers,

Thanks for reporting back on your issue.
To give me some more context, could you please share some more details of your code ?
What do your impacted models look like ? How you defined the relationships, and how you used the flattener ? The best would be to have a minimal reproducible example.

You can send me the snippets in private message if you’d rather avoid posting them on this forum

Thanks :pray:

Regards,
@Nicolas.M

Hello @Nicolas.M

Thanks for getting back to me.

The answer to your questions is already pretty much defined in my original post.

What do your impacted models look like ?

How you defined the relationships, and how you used the flattener ?

The flattener is one level-deep, configured by the asFields attribute in flattenOptions, not using the plugin.

The best would be to have a minimal reproducible example.

It takes a bit of time to do this. I don’t know, when I will find time to set this up. In the meantime, feel free to try it yourself.

Hello @David_Roegiers,

I believe I have reproduced the issue that you are refering to and I am working on a fix.

I will keep this thread updated with its resolution.

1 Like

Hello,

I have just released @forestadmin/datasource-mongoose v1.6.6 in order to fix this issue. Can you please upgrade your agent and let me know if this solves your issue ?
Thanks

Hello @Nicolas.M ,

Thanks for submitting this improvement, and apologies for not getting back to you earlier. There have been some pressing things on our plate in the meantime.

So, your release fixed the multiple flattening problems we had on ForestAdmin. Hooray!

Just before releasing it, I saved a bad issue for our operators, since the search does not work any more. Very much not, hooray!

I tried different approaches and can confirm, the search is simply bogus on all methods and collections. No matter what I give in, it simply returns all paginated records without applying filtering.

Not sure, whether this regression is part of this or another improvement.

Can you look into it? I assume it is already fixed or am I the only one, who wants to jump on this datasource-mongoose version?

Merci

Hello @David_Roegiers,

Thanks for letting us know that the flattening issues have been solved.

We will look into the search issues and keep you updated.

Cheers

Nicolas

During the work on the fix for the flattening issue we did stumble accross some issues with the search (which were already there before 1.6.6), and have have been fixed in the follow-up release @forestadmin/datasource-mongoose@1.6.7.

I have tested a couple use cases in this version, including flattened fields, global search bar, filtering on specific columns with various types and so on, but did not find anything unexpected on the search behavior.

Can you try upgrading to 1.6.7 or above and test again ?

If still encounter issues, could you please open up a new post with a specific search issue that you have so that we can reproduce ?

Thanks :pray:

Hi @Nicolas, thanks but no it does not work. Here is my setup:

"@forestadmin/agent": "^1.35.16",
"@forestadmin/datasource-mongoose": "1.5.29",
"@forestadmin/datasource-replica": "^1.0.42",
"@forestadmin/plugin-flattener": "^1.0.69",

When I switch “@forestadmin/datasource-mongoose” from “1.5.30” to “1.5.31” all the search features stop working. They return simply all values, no matter what the filter is.

What should I do?

Copying this in a separate issue, as you requested.