Example usage for org.springframework.data.mongodb.core DocumentCallbackHandler processDocument

List of usage examples for org.springframework.data.mongodb.core DocumentCallbackHandler processDocument

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.core DocumentCallbackHandler processDocument.

Prototype

void processDocument(Document document) throws MongoException, DataAccessException;

Source Link

Usage

From source file:org.springframework.data.mongodb.core.MongoTemplate.java

private void executeQueryInternal(CollectionCallback<DBCursor> collectionCallback, CursorPreparer preparer,
        DocumentCallbackHandler callbackHandler, String collectionName) {

    try {//from  w w  w .  ja  v  a2 s . co m
        DBCursor cursor = collectionCallback.doInCollection(getAndPrepareCollection(getDb(), collectionName));

        if (preparer != null) {
            cursor = preparer.prepare(cursor);
        }

        for (DBObject dbobject : cursor) {
            callbackHandler.processDocument(dbobject);
        }
    } catch (RuntimeException e) {
        throw potentiallyConvertRuntimeException(e);
    }
}