code: public DBObject toDBObject(final Object entity) {
          try {
              return mapper.toDBObject(entity);
          } catch (Exception e) {
              throw new MappingException("Could not map entity to DBObject", e);
          }
      }
docs: Converts an entity to a DBObject.  This method is primarily an internal method. Reliance on this method may break your application
  in
  future releases.
  
  @param entity the entity to convert
  @return the DBObject