grails/grails-data-mapping — pull request #41 by SAgrawal14 (2014-08-29 13:25:17+00:00)
Title: Mongo enum

## Implementation Notes

### Problem

Please see http://stackoverflow.com/questions/23888644/saving-enum-with-custom-id-in-grails-mongodb for detailed description of the requirement.

### Solution

Previously, enums are treated as simple type https://github.com/grails/grails-data-mapping/blob/3.x/grails-datastore-core/src/main/groovy/org/grails/datastore/mapping/model/MappingFactory.java#L131, but now first checking if enum has a user type then marking it as custom type.

Added enum type marshaller to support enum number conversion (in read, write & query operations) and also support enums with ordinal mapping and enum with no id (default behavior).

Reverted the commit https://github.com/grails/grails-data-mapping/commit/6ee2e1260a5134a264cd251f9f6d2cc6b55a6a9c and added support in new EnumType. This enhanced & fixed querying a domain class with an enum which is mapped as ordinal.