Smart collection display broken with v8?

Hello guys,

I’m new on ForestAdmin and I’m loving the projet, very nice work guys!

I’m trying to setup this feature (Display and edit MongoDB array as virtual collection - Developer guide) but it’s seems broken with the forest-express-mongoose v8.0.0…

Here is my code:

const { collectionName } = require('../models');
const testRecordGetter = new RecordGetter(collectionName);

And I get this error

Any ideas?


1 Like

Hello @alex42 ! :wave: Welcome to our community :tada: :confetti_ball:

This example wasn’t update to the last version.
The forest-express-mongoose v8.X introduce a breaking change on RecordGetter.

You should instantiate the RecordGetter with more informations.

const { query, user } = request;
new RecordGetter(collectionName, user, query)

Let me know if it helps. In the meanwhile I will communicate to the team to update the documentation.

Kind regards,

Hello @morganperre,

Thanks a lot for your fast reply, it’s worked!!!

But now when I’m trying to update a nested element (using: Display and edit MongoDB array as virtual collection - Developer guide)

I’m using the findById function

It’s seems that the findById does not return the nested data (steps array in my case)

Screenshot 2022-03-21 at 12.17.42

When I’m using collectionRecordGetter.get, I’m able to get the steps but the function is undefined…

Any trought?

Thanks a lot,

Hey again,

You’re directly using mongoose findById fonction. Your behaviour seems weird but If you need to do something really custom you should look directly at the mongoose documentation.

If you want to update records you can either use custom mongoose implementation (example: findById/find/findOne+ (you can also use collection.update) or use the RecordUpdater that is in the forest-express-mongoose library, you can find some example in our documentation.

Kind regards,