本文整理了Java中org.springframework.data.mongodb.core.query.Update.fromDocument()
方法的一些代码示例,展示了Update.fromDocument()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Update.fromDocument()
方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.query.Update
类名称:Update
方法名:fromDocument
[英]Creates an Update instance from the given Document. Allows to explicitly exclude fields from making it into the created Update object. Note, that this will set attributes directly and not use $set. This means fields not given in the Document will be nulled when executing the update. To create an only-updating Update instance of a Document, call #set(String,Object) for each value in it.
[中]从给定文档创建更新实例。允许在创建的更新对象中明确排除字段。请注意,这将直接设置属性,而不使用$set。这意味着在执行更新时,文档中未给出的字段将为空。要创建文档的唯一更新实例,请为其中的每个值调用#set(String,Object)。
代码示例来源:origin: spring-projects/spring-data-mongodb
public UpdateDefinition updateWithoutId() {
return new MappedUpdate(Update.fromDocument(document, ID_FIELD));
}
代码示例来源:origin: org.springframework.data/spring-data-mongodb
public UpdateDefinition updateWithoutId() {
return new MappedUpdate(Update.fromDocument(document, ID_FIELD));
}
代码示例来源:origin: onsoul/HA-DB
public T update(String id, Document updoc, T t) {
Update update = Update.fromDocument(updoc, "");
Query query = Query.query(Criteria.where(Opations.ID_FIELD).is(id));
T result = (T) mongoTemplate.findAndModify(query, update, t.getClass());
return result;
}
内容来源于网络,如有侵权,请联系作者删除!