Example usage for com.mongodb.gridfs GridFSFile setMetaData

List of usage examples for com.mongodb.gridfs GridFSFile setMetaData

Introduction

In this page you can find the example usage for com.mongodb.gridfs GridFSFile setMetaData.

Prototype

public void setMetaData(final DBObject metadata) 

Source Link

Document

Gets the file metadata.

Usage

From source file:org.elasticsearch.river.mongodb.util.MongoDBHelper.java

License:Apache License

public static DBObject applyFieldFilter(DBObject object, final Set<String> includeFields,
        final Set<String> excludeFields) {
    if (object instanceof GridFSFile) {
        GridFSFile file = (GridFSFile) object;
        DBObject metadata = file.getMetaData();
        if (metadata != null) {
            file.setMetaData(applyFieldFilter(metadata, includeFields, excludeFields));
        }//from   w w  w  . ja v  a 2s  .c om
    } else {
        object = MongoDBHelper.applyExcludeFields(object, excludeFields);
        object = MongoDBHelper.applyIncludeFields(object, includeFields);
    }
    return object;
}