Details

      Description

      The toString(…) method on Update class is breaking when there are custom mappings used for e.g., Joda DateTime. I think this is falling back to driver's JSON serializer rather than using Spring Data MongoDB mappings. The following is stacktrace.

      java.lang.RuntimeException: json can't serialize type : class org.joda.time.DateTime
      	at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:77)
      	at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317)
      	at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79)
      	at com.mongodb.util.JSONSerializers$MapSerializer.serialize(JSONSerializers.java:317)
      	at com.mongodb.util.ClassMapBasedObjectSerializer.serialize(ClassMapBasedObjectSerializer.java:79)
      	at com.mongodb.util.JSON.serialize(JSON.java:55)
      	at com.mongodb.util.JSON.serialize(JSON.java:40)
      	at com.mongodb.BasicDBObject.toString(BasicDBObject.java:83)
      	at org.springframework.data.mongodb.core.query.Update.toString(Update.java:375)
      	at 

        Issue Links

          Activity

          Hide
          olivergierke Oliver Gierke added a comment -

          This is as expected unfortunately as a BasicDBObject rejects non-native MongoDB types. User SerializationUtils.serializeToJsonSafely(…). It will render $java : … for every non primitive type.

          Show
          olivergierke Oliver Gierke added a comment - This is as expected unfortunately as a BasicDBObject rejects non-native MongoDB types. User SerializationUtils.serializeToJsonSafely(…) . It will render $java : … for every non primitive type.
          Hide
          olivergierke Oliver Gierke added a comment -

          Sorry, I got you wrong. I thought you were using Update.getUpdateObject().toString() directly. Aggreed that our own toString() implementation should use SerializationUtils.

          Show
          olivergierke Oliver Gierke added a comment - Sorry, I got you wrong. I thought you were using Update.getUpdateObject().toString() directly. Aggreed that our own toString() implementation should use SerializationUtils .
          Hide
          olivergierke Oliver Gierke added a comment -

          That's fixed in master and the bugfix branch.

          Show
          olivergierke Oliver Gierke added a comment - That's fixed in master and the bugfix branch.

            People

            • Assignee:
              olivergierke Oliver Gierke
              Reporter:
              poornasubhash Poorna Subhash
              Last updater:
              Oliver Gierke
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Agile