bson/src/main/org/bson/RawBsonDocument.java
public <T> T decode(final Decoder<T> decoder) {
        BsonBinaryReader reader = createReader();
        try {
            return decoder.decode(reader, DecoderContext.builder().build());
        } finally {
            reader.close();
        }
    }
public <T> T decode(final Decoder<T> decoder) {
        BsonBinaryReader reader = createReader();
        try {
            return decoder.decode(reader, DecoderContext.builder().build());
        } finally {
            reader.close();
        }
    }
Decode this into a document.

@param decoder the decoder to facilitate the transformation
@param <T>   the BSON type that the codec encodes/decodes
@return the decoded document
@since 3.6