Example usage for com.mongodb WriteResult wasAcknowledged

List of usage examples for com.mongodb WriteResult wasAcknowledged

Introduction

In this page you can find the example usage for com.mongodb WriteResult wasAcknowledged.

Prototype

public boolean wasAcknowledged() 

Source Link

Document

Returns true if the write was acknowledged.

Usage

From source file:com.r573.enfili.common.resource.db.mongo.MorphiaDbManager.java

License:Apache License

public <T extends BaseMongoObject> void findAndDelete(Class<T> clazz, String queryField, String queryValue) {
    log.debug("findAndDelete for type " + clazz.getName() + " queryField " + queryField + " searchTerm "
            + queryValue);/*from w  ww. j  a va  2 s .  c  om*/
    Query<T> query = ds.find(clazz, queryField, queryValue);
    WriteResult result = ds.delete(query);
    if (!result.wasAcknowledged()) {
        throw new MongoRuntimeException(ERR_DB_WRITE_FAILURE,
                "Error, write was not acknowleged for delete query: " + query.toString());
    }
}