morphia icon indicating copy to clipboard operation
morphia copied to clipboard

Query with disable validation fails with embedded keys

Open nitinkcv opened this issue 10 years ago • 2 comments

I have a class annotated with @Entity and while querying i disable validation using getDs().createQuery(collectionName, ResourceEntity.class).disableValidation(). When i construct my query (with either filter or field method) for simple keys the query works fine.

However when i construct the query for embedded keys (for e.g. query.field('foo.bar').equal('value') morphia throws an exception @ https://github.com/mongodb/morphia/blob/master/morphia/src/main/java/org/mongodb/morphia/query/QueryValidator.java#L99.

I haven't gone through the logic in details but i guess if the disableValidation is enabled, then we should break out from validateQuery early on. This looks to be a bug as the documentation seems to suggest implicitly it should work for both simple and embedded keys.

nitinkcv avatar May 25 '16 21:05 nitinkcv

This seems to work for me. Can you check the linked test case and see what I'm missing?

evanchooly avatar Jun 15 '16 14:06 evanchooly

between the test working and #961 this should be resolved. If you're still running in to this, please reopen this one or a new one with the details.

evanchooly avatar Jul 11 '16 13:07 evanchooly