@CompileStatic class MongoEntityTraitProvider extends java.lang.Object implements GormEntityTraitProvider
Tells GORM to use the MongoEntity trait for Mongo entities
| Type | Name and description |
|---|---|
boolean |
available |
java.lang.Class<?> |
defaultIdentityTypeString, not ObjectId. |
java.lang.Class |
entityTrait |
| Constructor and description |
|---|
MongoEntityTraitProvider() |
| Methods inherited from class | Name |
|---|---|
class java.lang.Object |
java.lang.Object#equals(java.lang.Object), java.lang.Object#getClass(), java.lang.Object#hashCode(), java.lang.Object#notify(), java.lang.Object#notifyAll(), java.lang.Object#toString(), java.lang.Object#wait(), java.lang.Object#wait(long), java.lang.Object#wait(long, int) |
String, not ObjectId.
A Mongo entity declaring a String id is given a generated ObjectId in its
hexadecimal form, so it reads and binds as an ordinary String - in URLs, in JSON, and as a
request parameter. An ObjectId-typed id is generated the same way and gives up that
convenience everywhere else: it serializes as its component fields rather than a hex string, and
every caller has to construct one. Neither involves the sequence collection a Long id
needs. An entity wanting the String form in code and a native ObjectId in storage asks
for it with id storedAs: ObjectId.