ppetzold / nestjs-paginate

Pagination and filtering helper method for TypeORM repositories or query builders using Nest.js framework :book::paperclip:
MIT License
450 stars 100 forks source link

Is there a way to include null values when filtering on relations ? #1028

Open jlefebvre1997 opened 1 week ago

jlefebvre1997 commented 1 week ago

At the moment, since filtering on relations act as a simplified left join, if the requested relation is null, the results are not included. I think it's not the right behaviour, since for example if I ask for cats filtering by toys.color=$not:$eq:red, I expect cats that do not have any toys to show up as well (but that's debatable ofc)

Helveg commented 3 days ago

Left joins should include null values 🤔 Inner joins don't. Can you see if adding a 2nd filter with toys.color=$or:$null gets you the correct results?