Package com.mongodb.client.model
Class ReplaceOneModel<T>
java.lang.Object
com.mongodb.client.model.WriteModel<T>
com.mongodb.client.model.ReplaceOneModel<T>
- Type Parameters:
T
- the type of document to replace. This can be of any type for which aCodec
is registered
A model describing the replacement of at most one document that matches the query filter.
- Since:
- 3.0
- MongoDB documentation
- Replace
-
Constructor Summary
ConstructorDescriptionReplaceOneModel
(Bson filter, T replacement) Construct a new instance.ReplaceOneModel
(Bson filter, T replacement, ReplaceOptions options) Construct a new instance. -
Method Summary
Modifier and TypeMethodDescriptionGets the query filter.Gets the document which will replace the document matching the query filter.Gets the ReplaceOptions to apply.toString()
-
Constructor Details
-
ReplaceOneModel
Construct a new instance.- Parameters:
filter
- a document describing the query filter, which may not be null.replacement
- the replacement document
-
ReplaceOneModel
Construct a new instance.- Parameters:
filter
- a document describing the query filter, which may not be null.replacement
- the replacement documentoptions
- the options to apply- Since:
- 3.7
-
-
Method Details
-
getFilter
Gets the query filter.- Returns:
- the query filter
-
getReplacement
Gets the document which will replace the document matching the query filter.- Returns:
- the replacement document
-
getReplaceOptions
Gets the ReplaceOptions to apply.- Returns:
- the replace options
- Since:
- 3.7
-
toString
-