Example usage for com.mongodb.client.model UpdateManyModel UpdateManyModel

List of usage examples for com.mongodb.client.model UpdateManyModel UpdateManyModel

Introduction

In this page you can find the example usage for com.mongodb.client.model UpdateManyModel UpdateManyModel.

Prototype

public UpdateManyModel(final Bson filter, final List<? extends Bson> update) 

Source Link

Document

Construct a new instance.

Usage

From source file:org.wso2.extension.siddhi.store.mongodb.MongoDBEventTable.java

License:Open Source License

@Override
protected void update(CompiledCondition compiledCondition, List<Map<String, Object>> list,
        Map<String, CompiledExpression> map, List<Map<String, Object>> list1)
        throws ConnectionUnavailableException {
    List<UpdateManyModel<Document>> parsedRecords = list.stream().map(conditionParameterMap -> {
        int ordinal = list.indexOf(conditionParameterMap);
        Document updateFilter = MongoTableUtils.resolveCondition((MongoCompiledCondition) compiledCondition,
                conditionParameterMap);//from  w  w  w .j a v a2 s  .c  om
        Document updateDocument = new Document().append("$set", list1.get(ordinal));
        return new UpdateManyModel<Document>(updateFilter, updateDocument);
    }).collect(Collectors.toList());
    this.bulkWrite(parsedRecords);
}