hasMany Smart Relationship not loading


I encounter an issue loading one specific smart relationship and I can’t find the reason.

I have 2 smart collections (Client and Driver) based on the same real collection (User).
The schema for each smart collection is quite similar. The mail difference are filters and other specific display.
I have already succesfully implemented smart relationship for each of them.
But when I try to add a new has many smart relationship (notificationList), it works fine with my client smart collection but not with my driver smart collection.

I have implemented the relatioships the same way for each collection:

                    field: 'notificationsList',
                    type: ['String'],
                    reference: 'Notification._id'

The UI link display fine but in the case of the drivers, no endpoints are called (see screenshots enclosed).



Can you help me understand what is wrong ?


  • “database_type”: “MongoDB”,
  • “liana”: “forest-express-mongoose”,
  • “liana_version”: “6.3.0”,
  • “engine”: “nodejs”,
  • “engine_version”: “10.19.0”,
  • “orm_version”: "5.8.5

Hi @Florian_Belliard :wave: thank you for your feedback.

Can you provide me the declaration of your User collection and the definition of your Client and Driver smart collection please. It would help me to reproduce.

Have you got any error on your browser console ?

Hello @Florian_Belliard :wave:

Do you observe this issue on the client collection sometimes or only in the driver one ?


It happens only on the driver collection everytime. The client collection works fine.

Hi @Florian_Belliard could you also share with us the way you serialize drivers list response?

If no request is triggered by the browser when you access the “notificationsList”, it is probably because the resource link to “notificationsList” is not transmitted or well serialized in the drivers context.
(If it works for clients, it is probably well serialized in this case).

Hi @arnaud,

I’m serializing the notificationsList exactly the same way in clients or drivers case. It’s the same endpoint that is called.

const JSONAPISerializer = require('jsonapi-serializer').Serializer;


let serializer = new JSONAPISerializer('Notification', {
            attributes: ['name', 'topic', 'type', 'inAppBehavior', 'createdAt', 'userStatus', 'userStatusChangedAt'],
            keyForAttribute: 'camelCase',
            meta: { "count": _.size(user.notifications) }


I have just updated the way I serialize drivers and clients using the Liana.ResourceSerializer as you describe it in your documentation.

        let serializedNotifications = await new Liana.ResourceSerializer(
            { count: totalRecords }


But the issue stays the same. Works fine for clients and not for drivers.

@Florian_Belliard thank you for sharing the Serializer definition.

Unfortunately I haven’t been able ro reproduce on my end.

As Arnaud said, knowing that the requests is not sent means there is an issue on the retrieval of the Drivers. To see which difference there might be, could you share with me the get route implementation for both the Drivers and Clients collection?

Thank you

Ok I fixed my issue. Since it’s a smart collection, I had to send the notificationList as a relationships in the response of the getOne endpoint…

Thanks for your help !

1 Like