michaelklishin/monger

Can't find a codec for class java.math.BigDecimal.

xingzheone opened this issue · 3 comments

org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.math.BigDecimal.
	at org.bson.codecs.configuration.CodecCache.getOrThrow(CodecCache.java:46)
	at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:63)
	at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:37)
	at com.mongodb.DBObjectCodec.writeValue(DBObjectCodec.java:213)
	at com.mongodb.DBObjectCodec.encodeMap(DBObjectCodec.java:223)
	at com.mongodb.DBObjectCodec.writeValue(DBObjectCodec.java:199)
	at com.mongodb.DBObjectCodec.encode(DBObjectCodec.java:131)
	at com.mongodb.DBObjectCodec.encode(DBObjectCodec.java:62)
	at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:63)
	at org.bson.codecs.BsonDocumentWrapperCodec.encode(BsonDocumentWrapperCodec.java:29)
	at com.mongodb.connection.UpdateCommandMessage.writeTheWrites(UpdateCommandMessage.java:84)
	at com.mongodb.connection.UpdateCommandMessage.writeTheWrites(UpdateCommandMessage.java:42)
	at com.mongodb.connection.BaseWriteCommandMessage.encodeMessageBodyWithMetadata(BaseWriteCommandMessage.java:129)
	at com.mongodb.connection.RequestMessage.encodeWithMetadata(RequestMessage.java:160)
	at com.mongodb.connection.WriteCommandProtocol.sendMessage(WriteCommandProtocol.java:220)
	at com.mongodb.connection.WriteCommandProtocol.execute(WriteCommandProtocol.java:101)
	at com.mongodb.connection.UpdateCommandProtocol.execute(UpdateCommandProtocol.java:64)
	at com.mongodb.connection.UpdateCommandProtocol.execute(UpdateCommandProtocol.java:37)
	at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:168)
	at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:289)
	at com.mongodb.connection.DefaultServerConnection.updateCommand(DefaultServerConnection.java:143)
	at com.mongodb.operation.UpdateOperation.executeCommandProtocol(UpdateOperation.java:76)
	at com.mongodb.operation.BaseWriteOperation$1.call(BaseWriteOperation.java:142)
	at com.mongodb.operation.BaseWriteOperation$1.call(BaseWriteOperation.java:134)
	at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:232)
	at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:223)
	at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:134)
	at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:61)
	at com.mongodb.Mongo.execute(Mongo.java:827)
	at com.mongodb.Mongo$2.execute(Mongo.java:810)
	at com.mongodb.DBCollection.executeWriteOperation(DBCollection.java:333)
	at com.mongodb.DBCollection.updateImpl(DBCollection.java:495)
	at com.mongodb.DBCollection.update(DBCollection.java:455)
	at com.mongodb.DBCollection.update(DBCollection.java:432)
	at monger.collection$update.invokeStatic(collection.clj:283)
	at monger.collection$update.invoke(collection.clj:265)
(mc/update db/currentdb table condition
                       {$inc {:a 3M} $set value}
                       {:upsert true}
                       )

Apparently MongoDB Java client cannot serialise BigDecimal values. Monger could provide it's own codec now that that part of the Java client is pluggable but currently doesn't and I'm not sure this is a good enough reason to switch.

ok, now (double 2M) is a good idea :)