I need QueryDSL Support for $regex and $nin on same field.
It seams to step in the trap that is mentioned in the mongoDb advanced Query hint:
"If you wish to specify both a regex and another operator for the same field, you need to use the $regex clause. For example, to find the customers where name matches the above regex but does not include 'acmeblahcorp', you would do the following:
I've tried something like:Code:db.customers.find( { name : { $regex : /acme.*corp/i, $nin : ['acmeblahcorp'] } } );"
querydsl version: 2.3.3Code:List names = ....; QCustomers.customers.name.startsWith('Mi').and.notIn(names)
Spring Data version: 1.0.3.RELEASE
A workaround using JSON Query is 2nd best, because i would like to use only querydsl. If you suggest using JSON query, how to code a regex like name : /^acme/ ? Simple copy the example above doesn't deliver the expected results.
Thanks
Bernd


Reply With Quote