Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2056

Updates.set fails with List type

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 3.3.0
    • Affects Version/s: 3.1.0
    • Component/s: Codecs
    • None

      collection.findOneAndUpdate(Filters.eq('_id', id), Updates.set('a', list));
      

      fails with

      org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class java.util.Arrays$ArrayList.
      	at org.bson.codecs.configuration.CodecCache.getOrThrow(CodecCache.java:46) ~[mongo-java-driver-3.1.0.jar:na]
      	at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:63) ~[mongo-java-driver-3.1.0.jar:na]
      	at org.bson.codecs.configuration.ProvidersCodecRegistry.get(ProvidersCodecRegistry.java:37) ~[mongo-java-driver-3.1.0.jar:na]
      	at $CodecRegistry_2952b5e77739.get(Unknown Source) ~[na:na]
      	at com.mongodb.client.model.BuildersHelper.encodeValue(BuildersHelper.java:35) ~[mongo-java-driver-3.1.0.jar:na]
      	at com.mongodb.client.model.Updates$SimpleUpdate.toBsonDocument(Updates.java:442) ~[mongo-java-driver-3.1.0.jar:na]
      	at com.mongodb.MongoCollectionImpl.toBsonDocument(MongoCollectionImpl.java:516) ~[mongo-java-driver-3.1.0.jar:na]
      	at com.mongodb.MongoCollectionImpl.findOneAndUpdate(MongoCollectionImpl.java:380) ~[mongo-java-driver-3.1.0.jar:na]
      

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jkemnade Jochen Kemnade
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: