eherve / mongoose-datatable

Server side dataTable request support for mongoose
MIT License
42 stars 29 forks source link

Query lookup another collection, if not found still return #61

Closed willyprayogo26 closed 3 years ago

willyprayogo26 commented 4 years ago

I want to ask, I want to query to join another collection. It's working. But, I want to handle if I can't found that object id in another collection and the reality it's still return data with value of field is null. Now, I don't want return that data if join/lookup/populate not found. How to solve this? Can you help me?

eherve commented 3 years ago

Hi,

Sorry for my very late reply...

I hope you found a solution to your problem. You can solve this by adding conditions in the options parameter of the dataTable method to add $ne: null to the joined field.