org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class [Ljava.lang.String;.

JIRA | Stanislav | 1 year ago
  1. 0

    Following the aggregation example http://docs.mongodb.org/getting-started/java/aggregation/ I have tried to make a similar operation on my set of documents. The only difference is that I tried to use $in in the $match clause. The same operation in the shell works db.getCollection('test').aggregate([ {"$match": {"code":{"$in":["1111", "2223344"]}}}]); using the driver it looks like this String[] codes = {"1112233", "2223344"}; AggregateIterable<Document> iterable = db.getCollection("test").aggregate(asList( new Document("$match", new Document("code", new Document("$in", codes))))); however it fails with Exception in thread "main" org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class [Ljava.lang.String;. 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.ChildCodecRegistry.get(ChildCodecRegistry.java:51) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:174) at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:172) at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:172) at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189) at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:131) at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:45) at org.bson.BsonDocumentWrapper.getUnwrapped(BsonDocumentWrapper.java:189) at org.bson.BsonDocumentWrapper.get(BsonDocumentWrapper.java:129) at com.mongodb.AggregateIterableImpl.execute(AggregateIterableImpl.java:118) at com.mongodb.AggregateIterableImpl.forEach(AggregateIterableImpl.java:107) at AggregationTest.main(AggregationTest.java:27)

    JIRA | 1 year ago | Stanislav
    org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class [Ljava.lang.String;.
  2. 0

    Following the aggregation example http://docs.mongodb.org/getting-started/java/aggregation/ I have tried to make a similar operation on my set of documents. The only difference is that I tried to use $in in the $match clause. The same operation in the shell works db.getCollection('test').aggregate([ {"$match": {"code":{"$in":["1111", "2223344"]}}}]); using the driver it looks like this String[] codes = {"1112233", "2223344"}; AggregateIterable<Document> iterable = db.getCollection("test").aggregate(asList( new Document("$match", new Document("code", new Document("$in", codes))))); however it fails with Exception in thread "main" org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class [Ljava.lang.String;. 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.ChildCodecRegistry.get(ChildCodecRegistry.java:51) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:174) at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:172) at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189) at org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:172) at org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189) at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:131) at org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:45) at org.bson.BsonDocumentWrapper.getUnwrapped(BsonDocumentWrapper.java:189) at org.bson.BsonDocumentWrapper.get(BsonDocumentWrapper.java:129) at com.mongodb.AggregateIterableImpl.execute(AggregateIterableImpl.java:118) at com.mongodb.AggregateIterableImpl.forEach(AggregateIterableImpl.java:107) at AggregationTest.main(AggregationTest.java:27)

    JIRA | 1 year ago | Stanislav
    org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class [Ljava.lang.String;.
  3. 0

    org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class [Ljava.lang.String;

    Stack Overflow | 2 weeks ago | Tom
    org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class [Ljava.lang.String;.
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Custom MapOfValuesConverter for dealing with key values containg restricted characters (., $)

    Google Groups | 1 year ago | Tom
    org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class com.frequentis.ps.persistence.mongo.integration.model.pojo.model.ComplexValue.

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.bson.codecs.configuration.CodecConfigurationException

      Can't find a codec for class [Ljava.lang.String;.

      at org.bson.codecs.configuration.CodecCache.getOrThrow()
    2. MongoDB Java Driver
      AggregateIterableImpl.forEach
      1. org.bson.codecs.configuration.CodecCache.getOrThrow(CodecCache.java:46)
      2. org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:63)
      3. org.bson.codecs.configuration.ChildCodecRegistry.get(ChildCodecRegistry.java:51)
      4. org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:174)
      5. org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189)
      6. org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:172)
      7. org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189)
      8. org.bson.codecs.DocumentCodec.writeValue(DocumentCodec.java:172)
      9. org.bson.codecs.DocumentCodec.writeMap(DocumentCodec.java:189)
      10. org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:131)
      11. org.bson.codecs.DocumentCodec.encode(DocumentCodec.java:45)
      12. org.bson.BsonDocumentWrapper.getUnwrapped(BsonDocumentWrapper.java:189)
      13. org.bson.BsonDocumentWrapper.get(BsonDocumentWrapper.java:129)
      14. com.mongodb.AggregateIterableImpl.execute(AggregateIterableImpl.java:118)
      15. com.mongodb.AggregateIterableImpl.forEach(AggregateIterableImpl.java:107)
      15 frames
    3. Unknown
      AggregationTest.main
      1. AggregationTest.main(AggregationTest.java:27)
      1 frame