查询条件不能否定? [英] Query condition cannot be negated?
问题描述
此查询条件出现一个奇怪的错误
I am getting a strange error with this query criteria
不是{我喜欢"holderFirstName","Steph%"}
Query of type ILike cannot be negated. Stacktrace follows:
Message: Query of type ILike cannot be negated
Line | Method
->> 463 | handle in org.grails.datastore.mapping.mongo.query.MongoQuery$29
推荐答案
mongo插件当前不支持否定ilike查询.位于 https://github.com/grails/grails-data-mapping/blob/61662051cd0fa23b43d9ba89e874460cf7b0b16f/grails-datastore-gorm-mongodb/src/main/groovy/org/grails/datastore/mapping/mongo/query/MongoQuery.java#L463 .
The mongo plugin does not currently support negating ilike queries. The code at https://github.com/grails/grails-data-mapping/blob/61662051cd0fa23b43d9ba89e874460cf7b0b16f/grails-datastore-gorm-mongodb/src/main/groovy/org/grails/datastore/mapping/mongo/query/MongoQuery.java#L538 which populates the negatedHandlers
map does not contain the ilike query so that will trigger an exception around https://github.com/grails/grails-data-mapping/blob/61662051cd0fa23b43d9ba89e874460cf7b0b16f/grails-datastore-gorm-mongodb/src/main/groovy/org/grails/datastore/mapping/mongo/query/MongoQuery.java#L463.
我不知道Mongo本身是否可以支持这种否定.如果您提交JIRA,我们可以对其进行调查.可能是Mongo可以处理它,而插件只需要考虑这一点,也可能是Mongo确实没有提供执行此操作的好方法.我不知道答案,但是我们当然可以进行调查.
I don't know if Mongo itself can support the negation or not. If you file a JIRA we can investigate it. It may be that Mongo can handle it and that the plugin just needs to account for that, or it may be that Mongo really doesn't provide a good way to do it. I don't know the answer, but of course we can investigate it.
这篇关于查询条件不能否定?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!