接口 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 value
        value - 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 value
        value - value to set
        返回:
        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 that DbDoc does not support expressions as a field values, please use patch(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 field
        value - value to insert
        返回:
        ModifyStatement
      • arrayAppend

        ModifyStatement arrayAppend​(String field,
                                    Object value)
        Append a value to the specified array.
        参数:
        field - document path to the array field
        value - value to append
        返回:
        ModifyStatement