code: public synchronized void setDBEncoderFactory(@Nullable final DBEncoderFactory factory) {
          this.encoderFactory = factory;
  
          //Are we are using default factory?
          // If yes then we can use CollectibleDBObjectCodec directly, otherwise it will be wrapped.
          Encoder<DBObject> encoder = (factory == null || factory == DefaultDBEncoder.FACTORY)
                                      ? getDefaultDBObjectCodec()
                                      : new DBEncoderFactoryAdapter(encoderFactory);
          this.objectCodec = new CompoundDBObjectCodec(encoder, objectCodec.getDecoder());
      }
docs: Set a custom encoder factory for this collection.  Set to null to use the default from MongoOptions.
  
  @param factory the factory to set.