Example usage for com.mongodb MapReduceCommand setBypassDocumentValidation

List of usage examples for com.mongodb MapReduceCommand setBypassDocumentValidation

Introduction

In this page you can find the example usage for com.mongodb MapReduceCommand setBypassDocumentValidation.

Prototype

public void setBypassDocumentValidation(@Nullable final Boolean bypassDocumentValidation) 

Source Link

Document

Sets whether to bypass document validation.

Usage

From source file:org.mongodb.morphia.MapReduceOptions.java

License:Apache License

@SuppressWarnings("deprecation")
MapReduceCommand toCommand(final Mapper mapper) {
    if (query.getOffset() != 0 || query.getFieldsObject() != null) {
        throw new QueryException("mapReduce does not allow the offset/retrievedFields query ");
    }/*from  w  ww.  j  a va2  s.co m*/

    final DBCollection dbColl = inputCollection != null
            ? getQuery().getCollection().getDB().getCollection(inputCollection)
            : query.getCollection();
    final String target = outputCollection != null ? outputCollection
            : mapper.getMappedClass(resultType).getCollectionName();

    final MapReduceCommand command = new MapReduceCommand(dbColl, map, reduce, target, outputType,
            query.getQueryObject());
    command.setBypassDocumentValidation(bypassDocumentValidation);
    command.setCollation(collation);
    command.setFinalize(finalize);
    command.setJsMode(jsMode);
    command.setLimit(limit);
    command.setMaxTime(maxTimeMS, TimeUnit.MILLISECONDS);
    command.setOutputDB(outputDB);
    command.setReadPreference(readPreference);
    command.setScope(scope);
    command.setSort(query.getSortObject());
    command.setVerbose(verbose);

    return command;
}