Comments (3)
@techniq We also encounter the same issue here. Using version 7.0.3.
Nested query object with multiple props on the same level, using odata "in" operator, create a duplicated query string. Duplication happens as many times as the number of props on the same level (3 props = 3 duplications).
Looking forward for solution. Thank you.
import buildODataQueryFn from 'odata-query';
const query = {
filter: {
components: {
control_number: {
in: ['0158'],
},
component1_number: {
in: ['0179'],
},
component2_number: {
in: ['0187'],
},
},
},
};
const queryString = buildODataQueryFn(query)
console.log(queryString)
// ?$filter=components/control_number in ('0158') and components/component1_number in ('0179') and components/component2_number in ('0187') and components/control_number in ('0158') and components/component1_number in ('0179') and components/component2_number in ('0187') and components/control_number in ('0158') and components/component1_number in ('0179') and components/component2_number in ('0187')
from odata-query.
Can confirm, we've got the exact same issue here:
let filter = {
users: {
firstName: { contains: 'admin' },
isActive: { eq: true },
},
not: { users: { roles: { any: {} } } },
};
buildQuery({ filter });
results in:
"?$filter=contains(users/firstName,'admin') and users/isActive eq true and contains(users/firstName,'admin') and users/isActive eq true and not(users/roles/any())"
from odata-query.
I'd be happy to review a PR, but to be honest, I don't have much time to dig into the issue.
from odata-query.
Related Issues (20)
- Automatically Title-Case Camel-Cased props HOT 1
- Filter with Any clause bad conversion
- ESM default export is not properly defined
- Add $skip support to $expand ExpandOptions
- TS error on $select when $orderBy added HOT 1
- not requires a whitespace
- [Question] Is the project maintained? HOT 4
- Select within an expand on an optional property not compatible with keyof
- Support compute query option HOT 7
- Support for an equality filter comparing two properties
- option to add custom query params HOT 1
- New Version Published? HOT 1
- adding whitespace after contains
- Parse query-string back into queryOptions-object HOT 2
- Add raw's description in documentation HOT 1
- Support for custom operator HOT 1
- Handling Typed Property Name Filter
- Issue with not operator inside collection filter
- $apply GroupBy Transform not capable of producing the query needed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from odata-query.