接口 ModifyStatement
-
- 所有超级接口:
Statement<ModifyStatement,Result>
- 所有已知实现类:
ModifyStatementImpl
public interface ModifyStatement extends Statement<ModifyStatement,Result>
A statement representing a set of document modifications.
-
-
嵌套类概要
-
从接口继承的嵌套类/接口 com.mysql.cj.xdevapi.Statement
Statement.LockContention
-
-
方法概要
所有方法 实例方法 抽象方法 修饰符和类型 方法 说明 ModifyStatementarrayAppend(String field, Object value)Append a value to the specified array.ModifyStatementarrayInsert(String field, Object value)Insert a value into the specified array.ModifyStatementchange(String docPath, Object value)Add an update to the statement setting the field, if it exists at the document path, to the given value.ModifyStatementlimit(long numberOfRows)Add/replace the document limit for this statement.ModifyStatementpatch(DbDoc document)Takes in a patch object and applies it on all documents matching the modify() filter, using the JSON_MERGE_PATCH() function.ModifyStatementpatch(String document)Takes in a document patch and applies it on all documents matching the modify() filter, using the JSON_MERGE_PATCH() function.ModifyStatementset(String docPath, Object value)Add an update to the statement setting the field as the document path to the given value for all documents matching the search criteria.ModifyStatementsort(String... sortFields)Add/replace the order specification for this statement.ModifyStatementunset(String... fields)Nullify the given fields.-
从接口继承的方法 com.mysql.cj.xdevapi.Statement
bind, bind, bind, bind, clearBindings, execute, executeAsync
-
-
-
-
方法详细资料
-
sort
ModifyStatement sort(String... sortFields)
Add/replace the order specification for this statement.- 参数:
sortFields- sort expression- 返回:
ModifyStatement
-
limit
ModifyStatement limit(long numberOfRows)
Add/replace the document limit for this statement.- 参数:
numberOfRows- limit- 返回:
ModifyStatement
-
set
ModifyStatement set(String docPath, Object value)
Add an update to the statement setting the field as the document path to the given value for all documents matching the search criteria.- 参数:
docPath- document path to the given valuevalue- value to set- 返回:
ModifyStatement
-
change
ModifyStatement change(String docPath, Object value)
Add an update to the statement setting the field, if it exists at the document path, to the given value.- 参数:
docPath- document path to the given valuevalue- value to set- 返回:
ModifyStatement
-
unset
ModifyStatement unset(String... fields)
Nullify the given fields.- 参数:
fields- one or more field names- 返回:
ModifyStatement
-
patch
ModifyStatement patch(DbDoc document)
Takes in a patch object and applies it on all documents matching the modify() filter, using the JSON_MERGE_PATCH() function. Please note thatDbDocdoes not support expressions as a field values, please usepatch(String)method if you need such functionality.- 参数:
document- patch object- 返回:
ModifyStatement
-
patch
ModifyStatement patch(String document)
Takes in a document patch and applies it on all documents matching the modify() filter, using the JSON_MERGE_PATCH() function. A document patch is similar to a JSON object, with the key difference that document field values can be nested expressions in addition to literal values.
Example:
collection.modify("_id = :id")
.patch("{\"zip\": address.zip-300000, \"street\": CONCAT($.name, '''s street: ', $.address.street)}")
.bind("id", "2").execute();- 参数:
document- patch object- 返回:
ModifyStatement
-
arrayInsert
ModifyStatement arrayInsert(String field, Object value)
Insert a value into the specified array.- 参数:
field- document path to the array fieldvalue- value to insert- 返回:
ModifyStatement
-
arrayAppend
ModifyStatement arrayAppend(String field, Object value)
Append a value to the specified array.- 参数:
field- document path to the array fieldvalue- value to append- 返回:
ModifyStatement
-
-