Using loopback where filter would be a lot more versatile if you could do queries that relate the model's instance properties to one another:
{
where: {
modelId: id,
someProp: {
neq: {
property: someOtherProp
}
}
}
}
The neq I'm referencing denotes 'not equal' .. eg. someProp != someOtherProp.
Right now, If i want to compare 2 properties I need to go to SQL and do a manual query there. Can this be a feature for future release?
@sidewaiise see this sections Operators. There is neq operator for your use case.
@mrbatista thanks for chiming in.
@sidewaiise: Did above suggestion help you? The where filter supports _almost_ all comparison operators.
Closing this now. Should you need further assistance with it, please mention me in the comments and I'll be happy to help. Thank you and have a great weekend :smiley_cat:
Ok @gunjpan I think my point wasn't conveyed very well. Yes I'm aware there is a neq operator already available.
The important part is the property: someOtherProp part - where someOtherProp is actually another property name within the model. It would be similar to doing an SQL query like:
SELECT * FROM myTable WHERE column_A != column_B;
Does that make sense?
-> if using the above as a reference it would be: SELECT * FROM myTable WHERE someProp != someOtherProp;
@gunjpan Any update of this?
it seem so far this issue persists. only mongodb connector has some thing like this with allowExtendedOperators: true setting so your can add $where "this.xxx != this.yyy"
no solution to this problem so far?
Most helpful comment
Ok @gunjpan I think my point wasn't conveyed very well. Yes I'm aware there is a
neqoperator already available.The important part is the
property: someOtherProppart - wheresomeOtherPropis actually another property name within the model. It would be similar to doing an SQL query like:SELECT * FROM myTable WHERE column_A != column_B;Does that make sense?
-> if using the above as a reference it would be:
SELECT * FROM myTable WHERE someProp != someOtherProp;