Closed re-kfa closed 11 months ago
Hello,
I'm pleased to inform you that the issue you reported regarding the fetchByFilter function has been successfully addressed and resolved. The problem you encountered when comparing against null values has been rectified in the codebase.
The root cause was identified in the QueryBuilder.ts
file where null values were being checked using an incorrect approach. The solution involves modifying the way null values are handled within the code.
The implementation to fix this issue can be found in the following pull request (PR): GitHub PR #172. In this PR, you will find the changes that have been made to the code to accurately handle null value comparisons in line with the MongoDB documentation.
Thank you for bringing this issue to our attention, and we appreciate your patience throughout the resolution process. If you have any further questions or feedback, please don't hesitate to reach out.
Hi,
when using
fetchByFilter
it is not possible to compare againstnull
.For example:
The problem is that at this line https://github.com/e-Spirit/fsxa-api/blob/fb65a1ede599a0b3fe8c2271401355ee01b82cfa/src/modules/QueryBuilder.ts#L92
filter.value
is checked with the!
-operator which is true for anull
-value.When reading through Mongo-DB documentation this is the correct way to check for a
null
-value. https://www.mongodb.com/docs/manual/tutorial/query-for-null-fields/So I suggest to change the check for
filter.value
to!("value" in filter)
ortypeof filter.value === 'undefined'
as this only checks if the propertyvalue
is existing on the objectfilter
.