Skip to content

Commit

Permalink
Merge pull request #7 from alexander-riss/master
Browse files Browse the repository at this point in the history
Introduce optional switch for disabeling morphia query validation
  • Loading branch information
jkuehn committed Aug 14, 2011
2 parents c9f449e + 4a84688 commit 80e761f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/groovy/grails/plugins/mongodb/MongoPluginSupport.groovy
Expand Up @@ -340,8 +340,14 @@ class MongoPluginSupport {
def sort = queryParams.get('sort')?.toString()
def limit = (int)(queryParams.containsKey('max') ? queryParams.get('max') : 25).toInteger()
def offset = (int)(queryParams.get('offset') ?: 0).toInteger()

if (sort){
// handle the morphia query validation - default validation is set to true
def validation = queryParams.containsKey('validation') ? (boolean) queryParams.get('validation') : true

if(!validation){
// disables query validation - this enables querying of embedded object properties like 'parent.embedded.property'
query.disableValidation();
}
if (sort){
// in case we have a sorting defined we also need to handle the sort order:
// default order -> asc
// asc will become an empty prefix in front or the sorting field
Expand Down

0 comments on commit 80e761f

Please sign in to comment.