Issue with not operator inside collection filter
jjavierdguezas opened this issue · 0 comments
jjavierdguezas commented
I have the following scenario:
class User {
id: string;
[...]
teams: Member[];
}
class Member {
userId: string;
user: User;
teamId: string;
team: Team;
}
class Team {
id: string;
title: string;
[...]
}
and doing:
import buildQuery from "odata-query";
let query = buildQuery({
filter: {
Teams: {
all: {
and: [
{
"Team/Title": {
contains: "team1",
},
},
{
not: {
"Team/Title": {
contains: "team2",
},
},
},
],
},
},
},
});
console.log(query);
I expect:
?$filter=Teams/all(teams:((contains(teams/Team/Title,'team1')) and (not contains(teams/Team/Title,'team2'))))
but odata-query
produce an invalid query:
?$filter=Teams/all(teams:((contains(teams/Team/Title,'team1')) and (contains(teams/not/Team/Title,'team2'))))
as you can see teams/not/Team/Title
is wrong
Is this an issue or is there a way to achieve the expected query?
thanks in advance