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

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.0.0, 3.0.1, 3.0.2, 3.0.3
    • Component/s: API, BSON, Codecs
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      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

            Assignee:
            Unassigned
            Reporter:
            Guillermo Campelo
            None
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: