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

When using upsert=true with a custom codec, encodercontext returns isEncodingCollectibleDocument = false

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • 3.0.0, 3.0.1, 3.0.2, 3.0.3
    • API, BSON, Codecs
    • Fully Compatible

    Description

      when using :
      MongoCollection<SomeEntity> gameCollection = database.getCollection("entities", SomeEntity.class);

      gameCollection.findOneAndUpdate(filter, update, new FindOneAndUpdateOptions().upsert(true));

      SomeEntityCodec's encode method is called with a context that returns encodingCollectibleDocument=false

      See:
      com.mongodb.MongoCollectionImpl : 374
      toBsonDocument(update)

      bson.toBsonDocument(documentClass, codecRegistry)

      neither RawBsonDocument(wrapped, codec), nor BsonDocumentWrapper(wrappedDocument, encoder) takes into account the upsert flag(if it is true, it SHOULD be a encodingCollectibleDocument

      Attachments

        Activity

          People

            Unassigned Unassigned
            guicamest Guillermo Campelo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: