Nebulent - software solutions

Nebulent

Edie (Enterprise Data Intelligence Engine) is our latest application that is specifically designed to help organization get up to speed with Amazon Mechnical Turk platform without going through a learning curve. No need to code or manage any spreadsheets. Design your tasks and push your data through our qualified work force to get fast results at fraction of a penny.

Contacts

Contact information

Toll Free: +1(888)201-7922

Blog

MongoDB findModify with Spring Data

 

public static class FindAndModifyRequest implements Serializable { /**/ private static final long serialVersionUID = 1L; private Query query;  private Field field;  private Sort sort; private Update update; private boolean remove;  private boolean returnNew;  private boolean upsert;

 

/** * @param <T> * @param request * @param converter * @param collectionName * @return */ protected <T> T findAndModify(Class<T> clazz, FindAndModifyRequest request, String collectionName) { DBObject updateObj = request.getUpdateObject(); for (String key : updateObj.keySet()) { updateObj.put(key, mongoTemplate.getConverter().convertToMongoType(updateObj.get(key))); } DBObject queryObj = (request.getQuery() == null) ? new BasicDBObject() : queryMapper.getMappedObject(request.getQueryObject(), mongoTemplate.getConverter().getMappingContext().getPersistentEntity(clazz)); DBObject dbObject = getDbCollection(collectionName).findAndModify(/*request.getQueryObject()*/queryObj,       request.getFieldsObject(),       request.getSortObject(),       request.isRemove(),       /*request.getUpdateObject()*/updateObj,       request.isReturnNew(),       request.isUpsert()); if(dbObject == null) { return null; } return mongoTemplate.getConverter().read(clazz, dbObject); }

2011-11-15