Package io.vertx.ext.mongo
Class BulkOperation
- java.lang.Object
-
- io.vertx.ext.mongo.BulkOperation
-
public class BulkOperation extends Object
Contains all data needed for one operation of a bulk write operation.- Author:
- sschmitt
-
-
Constructor Summary
Constructors Constructor Description BulkOperation(JsonObject json)Json constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static BulkOperationcreateDelete(JsonObject filter)Create a new delete operation with the given filterstatic BulkOperationcreateInsert(JsonObject document)Create a new insert operation with the given documentstatic BulkOperationcreateReplace(JsonObject filter, JsonObject document)Create a new replace operation with the given filter and replace documentstatic BulkOperationcreateReplace(JsonObject filter, JsonObject document, boolean upsert)Create a new replace operation with the given filter, replace document, and the upsert flagstatic BulkOperationcreateUpdate(JsonObject filter, JsonObject document)Create a new update operation with the given filter and update documentstatic BulkOperationcreateUpdate(JsonObject filter, JsonObject document, boolean upsert, boolean multi)Create a new update operation with the given filter, update document, the upsert flag, and multi flagbooleanequals(Object o)CollationOptionsgetCollation()JsonObjectgetDocument()Returns the document, used by insert, replace, and update operationsJsonObjectgetFilter()Returns the filter document, used by replace, update, and delete operationsJsonObjectgetHint()Returns the operation hintStringgetHintString()Returns the operation hint stringBulkOperationTypegetType()Returns the operation typeinthashCode()booleanisMulti()Returns the multi flag, used by update and delete operationsbooleanisUpsert()Returns the upsert flag, used by update and replace operationsBulkOperationsetCollation(CollationOptions collation)BulkOperationsetDocument(JsonObject document)Sets the document, used by insert, replace, and update operationsBulkOperationsetFilter(JsonObject filter)Sets the filter document, used by replace, update, and delete operationsBulkOperationsetHint(JsonObject hint)Sets the operation hintBulkOperationsetHintString(String hintString)Sets the operation hint stringBulkOperationsetMulti(boolean multi)Sets the multi flag, used by update and delete operationsBulkOperationsetType(BulkOperationType type)Sets the operation typeBulkOperationsetUpsert(boolean upsert)Sets the upsert flag, used by update and replace operationsJsonObjecttoJson()Generate a json from this objectStringtoString()
-
-
-
Constructor Detail
-
BulkOperation
public BulkOperation(JsonObject json)
Json constructor- Parameters:
json- the json object
-
-
Method Detail
-
createDelete
public static BulkOperation createDelete(JsonObject filter)
Create a new delete operation with the given filter- Parameters:
filter- the filter- Returns:
- a new delete operation instance
-
createInsert
public static BulkOperation createInsert(JsonObject document)
Create a new insert operation with the given document- Parameters:
document- the document to insert- Returns:
- a new insert operation instance
-
createReplace
public static BulkOperation createReplace(JsonObject filter, JsonObject document)
Create a new replace operation with the given filter and replace document- Parameters:
filter- the filterdocument- the replace document- Returns:
- a new replace operation instance
-
createReplace
public static BulkOperation createReplace(JsonObject filter, JsonObject document, boolean upsert)
Create a new replace operation with the given filter, replace document, and the upsert flag- Parameters:
filter- the filterdocument- the replace documentupsert- the upsert flag- Returns:
- a new replace operation instance
-
createUpdate
public static BulkOperation createUpdate(JsonObject filter, JsonObject document)
Create a new update operation with the given filter and update document- Parameters:
filter- the filterdocument- the update document- Returns:
- a new update operation instance
-
createUpdate
public static BulkOperation createUpdate(JsonObject filter, JsonObject document, boolean upsert, boolean multi)
Create a new update operation with the given filter, update document, the upsert flag, and multi flag- Parameters:
filter- the filterdocument- the update documentupsert- the upsert flagmulti- the multi flag- Returns:
- a new update operation instance
-
getCollation
public CollationOptions getCollation()
-
setCollation
public BulkOperation setCollation(CollationOptions collation)
-
toJson
public JsonObject toJson()
Generate a json from this object- Returns:
- the json representation
-
getType
public BulkOperationType getType()
Returns the operation type- Returns:
- the operation type
-
setType
public BulkOperation setType(BulkOperationType type)
Sets the operation type- Parameters:
type- the operation type- Returns:
- this for fluency
-
getFilter
public JsonObject getFilter()
Returns the filter document, used by replace, update, and delete operations- Returns:
- the filter document
-
setFilter
public BulkOperation setFilter(JsonObject filter)
Sets the filter document, used by replace, update, and delete operations- Parameters:
filter- the filter document- Returns:
- this for fluency
-
getDocument
public JsonObject getDocument()
Returns the document, used by insert, replace, and update operations- Returns:
- the document
-
setDocument
public BulkOperation setDocument(JsonObject document)
Sets the document, used by insert, replace, and update operations- Parameters:
document- the document- Returns:
- this for fluency
-
isUpsert
public boolean isUpsert()
Returns the upsert flag, used by update and replace operations- Returns:
- the upsert flag
-
setUpsert
public BulkOperation setUpsert(boolean upsert)
Sets the upsert flag, used by update and replace operations- Parameters:
upsert- the upsert flag- Returns:
- this for fluency
-
isMulti
public boolean isMulti()
Returns the multi flag, used by update and delete operations- Returns:
- the multi flag
-
setMulti
public BulkOperation setMulti(boolean multi)
Sets the multi flag, used by update and delete operations- Parameters:
multi- the mutli flag- Returns:
- this for fluency
-
getHint
public JsonObject getHint()
Returns the operation hint- Returns:
- the operation hint
-
setHint
public BulkOperation setHint(JsonObject hint)
Sets the operation hint- Parameters:
hint- the operation hint- Returns:
- this for fluency
-
getHintString
public String getHintString()
Returns the operation hint string- Returns:
- the operation hint string
-
setHintString
public BulkOperation setHintString(String hintString)
Sets the operation hint string- Parameters:
hintString- the operation hint string- Returns:
- this for fluency
-
-