injecteer opened a new issue, #14386:
URL: https://github.com/apache/grails-core/issues/14386

   My domain classes are like:
   
   ```
   @Entity
   class Arbitrary {
     
     String id
   
     Map<String,Object> data
     
     Geometry geometry
       
     static embedded = [ 'data', 'geometry' ]
   }
   ```
   and
   ```
   import grails.mongodb.geo.MultiPoint
   @Entity
   class Geometry {
     MultiPoint points
   }
   ```
   
   Setting the `arbitrary.data = null` in controller works just fine, but 
`arbitrary.geometry = null` is ignored.
   
   In order to dance the problem around, I defined a fake constant and the 
checker method in Geometry class, like so:
   
   ```
   class Geometry {
     ...
     static final KINDA_NULL = new Geometry( points:MultiPoint.valueOf( [ [ 0, 
0 ] ] ) )
     
     boolean kindaNull() {
       points == KINDA_NULL.points
     }
   }
   ```
   and added the interceptor into Arbitrary class like so:
   ```
   class Arbitrary {
     ...
     def afterUpdate() {
       if( geometry.kindaNull() )
         Arbitrary.collection.update( [ _id:getId() ], [ $unset:[ geometry:1 ] 
] )
     }
   }
   ```
   Then it works kinda as expected.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to