code: public void toDBObject(final Object containingObject, final MappedField mf, final DBObject dbObj, final MapperOptions opts) {
          final Object fieldValue = mf.getFieldValue(containingObject);
          final TypeConverter enc = getEncoder(fieldValue, mf);
  
          final Object encoded = enc.encode(fieldValue, mf);
          if (encoded != null || opts.isStoreNulls()) {
              dbObj.put(mf.getNameToStore(), encoded);
          }
      }
docs: Converts an entity to a DBObject
  
  @param containingObject The object to convert
  @param mf               the MappedField to extract
  @param dbObj            the DBObject to populate
  @param opts             the options to apply