code: public DBObject getMetadataFromGFSEntity(GridFS gfs, EntityMetadata m, Object entity,
              KunderaMetadata kunderaMetadata)
      {
          MetamodelImpl metaModel = (MetamodelImpl) kunderaMetadata.getApplicationMetadata()
                  .getMetamodel(m.getPersistenceUnit());
  
          EntityType entityType = metaModel.entity(m.getEntityClazz());
  
          DBObject gfsMetadata = new BasicDBObject();
          Set<Attribute> columns = entityType.getAttributes();
          for (Attribute column : columns)
          {
              boolean isLob = ((Field) column.getJavaMember()).getAnnotation(Lob.class) != null;
              if (!isLob)
              {
                  DocumentObjectMapper.extractFieldValue(entity, gfsMetadata, column);
              }
          }
          return gfsMetadata;
      }
docs: Gets the metadata from GFS entity.
  
  @param gfs
  the gfs
  @param m
  the m
  @param entity
  the entity
  @param kunderaMetadata
  the kundera metadata
  @return the metadata from GFS entity