本文整理汇总了Java中org.springframework.data.mongodb.core.query.Update.getUpdateObject方法的典型用法代码示例。如果您正苦于以下问题:Java Update.getUpdateObject方法的具体用法?Java Update.getUpdateObject怎么用?Java Update.getUpdateObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.data.mongodb.core.query.Update
的用法示例。
在下文中一共展示了Update.getUpdateObject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildPullObject
import org.springframework.data.mongodb.core.query.Update; //导入方法依赖的package包/类
private DBObject buildPullObject(List<Entity> subEntities) {
Set<String> existingIds = new HashSet<String>(getSubDocDids(subEntities));
Query pullQuery = new Query(Criteria.where("_id").in(existingIds));
Update update = new Update();
update.pull(subField, pullQuery.getQueryObject());
return update.getUpdateObject();
}
示例2: buildPushObject
import org.springframework.data.mongodb.core.query.Update; //导入方法依赖的package包/类
private DBObject buildPushObject(List<Entity> subEntities) {
List<DBObject> subDocs = new ArrayList<DBObject>();
for (Entity entity : subEntities) {
subDocs.add(subDocToDBObject(entity));
}
Update update = new Update();
update.set("type", collection).pushAll(subField, subDocs.toArray());
return update.getUpdateObject();
}
示例3: buildPushObject
import org.springframework.data.mongodb.core.query.Update; //导入方法依赖的package包/类
private DBObject buildPushObject(List<Entity> entities) {
List<DBObject> docs = new ArrayList<DBObject>();
for (Entity entity : entities) {
docs.add(getDbObject(entity));
}
Update update = new Update();
update.set("type", denormalizeToEntity).pushAll(denormalizedToField, docs.toArray());
return update.getUpdateObject();
}
示例4: buildPullObject
import org.springframework.data.mongodb.core.query.Update; //导入方法依赖的package包/类
private DBObject buildPullObject(List<Entity> entities) {
Query pullQuery = new Query();
List <Criteria> orList = new ArrayList<Criteria>();
for (Entity entity : entities) {
String internalId = null;
if (denormalizedIdKey.equals("_id")) {
internalId = entity.getEntityId();
} else {
internalId = (String) entity.getBody().get(denormalizedIdKey);
}
//delete studentSectionAssociation DND where (sectionId(_id) = "x1" and beginDate(denormalizedKey) = "y1") OR (sectionId(_id) = "x2" and beginDate(denormalizedKey) = "y2") ...
//delete studentSchoolAssociation DND where (schoolld(_id) = "x1" and entryDate(denormalizedKey) = "y1") OR (schoolld(_id) = "x2" and entryDate(denormalizedKey) = "y2") ...
//DND -> denormalizedDoc
List<Criteria> andList = new ArrayList<Criteria>();
andList.add(Criteria.where("_id").is(internalId));
for(String denormalizedKey:denormalizedEntityKeys) {
String denormalizedValue = (String) entity.getBody().get(denormalizedKey);
andList.add( Criteria.where(denormalizedKey).is(denormalizedValue));
}
Criteria and = new Criteria().andOperator(andList.toArray(new Criteria[0]));
orList.add(and);
}
Criteria or = new Criteria().orOperator(orList.toArray(new Criteria[0]));
pullQuery.addCriteria(or);
Update update = new Update();
update.pull(denormalizedToField, pullQuery.getQueryObject());
return update.getUpdateObject();
}