I'm trying to use the aggregate with the scala driver, but I have the following error:
Caused by: org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class com.mongodb.client.model.BsonField.
at org.bson.codecs.configuration.CodecCache.getOrThrow(CodecCache.java:46) ~[mongo-java-driver-3.1.1.jar:na]
at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:63) ~[mongo-java-driver-3.1.1.jar:na]
at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:37) ~[mongo-java-driver-3.1.1.jar:na]
at com.mongodb.client.model.BuildersHelper.encodeValue(BuildersHelper.java:35) ~[mongo-java-driver-3.1.1.jar:na]
at com.mongodb.client.model.Aggregates$1.toBsonDocument(Aggregates.java:129) ~[mongo-java-driver-3.1.1.jar:na]
at com.mongodb.async.client.AggregateIterableImpl.createBsonDocumentList(AggregateIterableImpl.java:185) ~[mongodb-driver-async-3.2.0.jar:na]
at com.mongodb.async.client.AggregateIterableImpl.execute(AggregateIterableImpl.java:151) ~[mongodb-driver-async-3.2.0.jar:na]
at com.mongodb.async.client.AggregateIterableImpl.batchCursor(AggregateIterableImpl.java:141) ~[mongodb-driver-async-3.2.0.jar:na]
at com.mongodb.async.client.MongoIterableSubscription.requestInitialData(MongoIterableSubscription.java:48) ~[mongodb-driver-async-3.2.0.jar:na]
at com.mongodb.async.client.AbstractSubscription.tryRequestInitialData(AbstractSubscription.java:151) ~[mongodb-driver-async-3.2.0.jar:na]
at com.mongodb.async.client.AbstractSubscription.request(AbstractSubscription.java:82) ~[mongodb-driver-async-3.2.0.jar:na]
I tried to add codec registries but it does not help.
val codecRegistry = CodecRegistries.fromProviders(
new ValueCodecProvider(),
new DBObjectCodecProvider(),
new BsonValueCodecProvider())
I tried to add codec registries but it does not help.
Any idea?
Thanks in advance!
Yann