java.lang.Object
net.pincette.mongo.JsonClient
These are convenience functions to use JSON with the MongoDB API.
- Since:
- 1.4
- Author:
- Werner Donné
-
Method Summary
Modifier and TypeMethodDescriptionstatic CompletionStage<List<JsonObject>>aggregate(MongoCollection<Document> collection, ClientSession session, List<? extends Bson> pipeline) Finds JSON objects that come out ofpipeline.static CompletionStage<List<JsonObject>>aggregate(MongoCollection<Document> collection, ClientSession session, List<? extends Bson> pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.static CompletionStage<List<JsonObject>>aggregate(MongoCollection<Document> collection, ClientSession session, JsonArray pipeline) Finds JSON objects that come out ofpipeline.static CompletionStage<List<JsonObject>>aggregate(MongoCollection<Document> collection, ClientSession session, JsonArray pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.static CompletionStage<List<JsonObject>>aggregate(MongoCollection<Document> collection, List<? extends Bson> pipeline) Finds JSON objects that come out ofpipeline.static CompletionStage<List<JsonObject>>aggregate(MongoCollection<Document> collection, List<? extends Bson> pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.static CompletionStage<List<JsonObject>>aggregate(MongoCollection<Document> collection, JsonArray pipeline) Finds JSON objects that come out ofpipeline.static CompletionStage<List<JsonObject>>aggregate(MongoCollection<Document> collection, JsonArray pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.static Flow.Publisher<JsonObject>aggregationPublisher(MongoCollection<Document> collection, ClientSession session, List<? extends Bson> pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.static Flow.Publisher<JsonObject>aggregationPublisher(MongoCollection<Document> collection, ClientSession session, JsonArray pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.static Flow.Publisher<JsonObject>aggregationPublisher(MongoCollection<Document> collection, List<? extends Bson> pipeline) Finds JSON objects that come out ofpipeline.static Flow.Publisher<JsonObject>aggregationPublisher(MongoCollection<Document> collection, List<? extends Bson> pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.static Flow.Publisher<JsonObject>aggregationPublisher(MongoCollection<Document> collection, JsonArray pipeline) Finds JSON objects that come out ofpipeline.static Flow.Publisher<JsonObject>aggregationPublisher(MongoCollection<Document> collection, JsonArray pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.static CompletionStage<List<JsonObject>>find(MongoCollection<Document> collection) Finds all JSON objects.static CompletionStage<List<JsonObject>>find(MongoCollection<Document> collection, ClientSession session) Finds all JSON objects.static CompletionStage<List<JsonObject>>find(MongoCollection<Document> collection, ClientSession session, JsonObject filter) Finds JSON objects that matchfilter.static CompletionStage<List<JsonObject>>find(MongoCollection<Document> collection, ClientSession session, JsonObject filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.static CompletionStage<List<JsonObject>>find(MongoCollection<Document> collection, ClientSession session, Bson filter) Finds JSON objects that matchfilter.static CompletionStage<List<JsonObject>>find(MongoCollection<Document> collection, ClientSession session, Bson filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.static CompletionStage<List<JsonObject>>find(MongoCollection<Document> collection, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds all JSON objects.static CompletionStage<List<JsonObject>>find(MongoCollection<Document> collection, JsonObject filter) Finds JSON objects that matchfilter.static CompletionStage<List<JsonObject>>find(MongoCollection<Document> collection, JsonObject filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.static CompletionStage<List<JsonObject>>find(MongoCollection<Document> collection, Bson filter) Finds JSON objects that matchfilter.static CompletionStage<List<JsonObject>>find(MongoCollection<Document> collection, Bson filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.static CompletionStage<Optional<JsonObject>>findOne(MongoCollection<Document> collection, ClientSession session, JsonObject filter) Finds a JSON object.static CompletionStage<Optional<JsonObject>>findOne(MongoCollection<Document> collection, ClientSession session, Bson filter) Finds a JSON object.static CompletionStage<Optional<JsonObject>>findOne(MongoCollection<Document> collection, JsonObject filter) Finds a JSON object.static CompletionStage<Optional<JsonObject>>findOne(MongoCollection<Document> collection, Bson filter) Finds a JSON object.static Flow.Publisher<JsonObject>findPublisher(MongoCollection<Document> collection) Finds all JSON objects.static Flow.Publisher<JsonObject>findPublisher(MongoCollection<Document> collection, ClientSession session) Finds all JSON objects.static Flow.Publisher<JsonObject>findPublisher(MongoCollection<Document> collection, ClientSession session, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds all JSON objects.static Flow.Publisher<JsonObject>findPublisher(MongoCollection<Document> collection, ClientSession session, JsonObject filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.static Flow.Publisher<JsonObject>findPublisher(MongoCollection<Document> collection, ClientSession session, Bson filter) Finds JSON objects that matchfilter.static Flow.Publisher<JsonObject>findPublisher(MongoCollection<Document> collection, ClientSession session, Bson filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.static Flow.Publisher<JsonObject>findPublisher(MongoCollection<Document> collection, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.static Flow.Publisher<JsonObject>findPublisher(MongoCollection<Document> collection, JsonObject filter) Finds JSON objects that matchfilter.static Flow.Publisher<JsonObject>findPublisher(MongoCollection<Document> collection, JsonObject filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.static Flow.Publisher<JsonObject>findPublisher(MongoCollection<Document> collection, Bson filter) Finds JSON objects that matchfilter.static Flow.Publisher<JsonObject>findPublisher(MongoCollection<Document> collection, Bson filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.static CompletionStage<Boolean>insert(MongoCollection<Document> collection, JsonObject json) Inserts thecollectionwithjson.static CompletionStage<Boolean>insert(MongoCollection<Document> collection, JsonObject json, ClientSession session) Inserts thecollectionwithjson.static Stream<JsonObject>patch(JsonObject source, JsonObject target) Returns the stream of operation objects for a JSON patch.static Stream<JsonObject>Returns the stream of operation objects for a JSON patch.static CompletionStage<Boolean>update(MongoCollection<Document> collection, JsonObject json) Updates thecollectionwithjson.static CompletionStage<Boolean>update(MongoCollection<Document> collection, JsonObject json, ClientSession session) Updates thecollectionwithjson.static CompletionStage<Boolean>update(MongoCollection<Document> collection, JsonObject json, String id) Updates thecollectionwithjson.static CompletionStage<Boolean>update(MongoCollection<Document> collection, JsonObject json, String id, ClientSession session) Updates thecollectionwithjson.static CompletionStage<Boolean>update(MongoCollection<Document> collection, JsonObject source, JsonObject target) Updates thecollectionwithtarget, but with a bulk write containing only the differences withsource.static CompletionStage<Boolean>update(MongoCollection<Document> collection, JsonObject json, JsonValue id, ClientSession session) Updates thecollectionwithjson.static Flow.Publisher<JsonObject>watch(MongoCollection<Document> collection) Returns the changes that occur in a collection.
-
Method Details
-
aggregate
public static CompletionStage<List<JsonObject>> aggregate(MongoCollection<Document> collection, List<? extends Bson> pipeline) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.pipeline- the given pipeline.- Returns:
- The list of objects.
- Since:
- 1.4
-
aggregate
public static CompletionStage<List<JsonObject>> aggregate(MongoCollection<Document> collection, JsonArray pipeline) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.pipeline- the given pipeline.- Returns:
- The list of objects.
- Since:
- 1.4
-
aggregate
public static CompletionStage<List<JsonObject>> aggregate(MongoCollection<Document> collection, ClientSession session, List<? extends Bson> pipeline) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.pipeline- the given pipeline.- Returns:
- The list of objects.
- Since:
- 1.4
-
aggregate
public static CompletionStage<List<JsonObject>> aggregate(MongoCollection<Document> collection, ClientSession session, JsonArray pipeline) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.pipeline- the given pipeline.- Returns:
- The list of objects.
- Since:
- 1.4
-
aggregate
public static CompletionStage<List<JsonObject>> aggregate(MongoCollection<Document> collection, List<? extends Bson> pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.pipeline- the given pipeline.setParameters- a function to set the parameters for the result set.- Returns:
- The list of objects.
- Since:
- 1.4
-
aggregate
public static CompletionStage<List<JsonObject>> aggregate(MongoCollection<Document> collection, JsonArray pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.pipeline- the given pipeline.setParameters- a function to set the parameters for the result set.- Returns:
- The list of objects.
- Since:
- 1.4
-
aggregate
public static CompletionStage<List<JsonObject>> aggregate(MongoCollection<Document> collection, ClientSession session, List<? extends Bson> pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.pipeline- the given pipeline.setParameters- a function to set the parameters for the result set.- Returns:
- The list of objects.
- Since:
- 1.4
-
aggregate
public static CompletionStage<List<JsonObject>> aggregate(MongoCollection<Document> collection, ClientSession session, JsonArray pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.pipeline- the given pipeline.setParameters- a function to set the parameters for the result set.- Returns:
- The list of objects.
- Since:
- 1.4
-
aggregationPublisher
public static Flow.Publisher<JsonObject> aggregationPublisher(MongoCollection<Document> collection, List<? extends Bson> pipeline) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.pipeline- the given pipeline.- Returns:
- The object publisher.
- Since:
- 1.4
-
aggregationPublisher
public static Flow.Publisher<JsonObject> aggregationPublisher(MongoCollection<Document> collection, JsonArray pipeline) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.pipeline- the given pipeline.- Returns:
- The object publisher.
- Since:
- 1.4
-
aggregationPublisher
public static Flow.Publisher<JsonObject> aggregationPublisher(MongoCollection<Document> collection, List<? extends Bson> pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.pipeline- the given pipeline.setParameters- a function to set the parameters for the result set.- Returns:
- The object publisher.
- Since:
- 1.4
-
aggregationPublisher
public static Flow.Publisher<JsonObject> aggregationPublisher(MongoCollection<Document> collection, JsonArray pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.pipeline- the given pipeline.setParameters- a function to set the parameters for the result set.- Returns:
- The object publisher.
- Since:
- 1.4
-
aggregationPublisher
public static Flow.Publisher<JsonObject> aggregationPublisher(MongoCollection<Document> collection, ClientSession session, List<? extends Bson> pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.pipeline- the given pipeline.setParameters- a function to set the parameters for the result set.- Returns:
- The object publisher.
- Since:
- 1.4
-
aggregationPublisher
public static Flow.Publisher<JsonObject> aggregationPublisher(MongoCollection<Document> collection, ClientSession session, JsonArray pipeline, UnaryOperator<AggregatePublisher<BsonDocument>> setParameters) Finds JSON objects that come out ofpipeline.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.pipeline- the given pipeline.setParameters- a function to set the parameters for the result set.- Returns:
- The object publisher.
- Since:
- 1.4
-
find
Finds all JSON objects.- Parameters:
collection- the MongoDB collection.- Returns:
- The list of objects.
- Since:
- 2.0
-
find
public static CompletionStage<List<JsonObject>> find(MongoCollection<Document> collection, Bson filter) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.filter- the given filter. It may benull.- Returns:
- The list of objects.
- Since:
- 1.4
-
find
public static CompletionStage<List<JsonObject>> find(MongoCollection<Document> collection, JsonObject filter) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.filter- the given filter. It may benull.- Returns:
- The list of objects.
- Since:
- 1.4
-
find
public static CompletionStage<List<JsonObject>> find(MongoCollection<Document> collection, ClientSession session) Finds all JSON objects.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.- Returns:
- The list of objects.
- Since:
- 2.0
-
find
public static CompletionStage<List<JsonObject>> find(MongoCollection<Document> collection, ClientSession session, Bson filter) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.filter- the given filter. It may benull.- Returns:
- The list of objects.
- Since:
- 1.4
-
find
public static CompletionStage<List<JsonObject>> find(MongoCollection<Document> collection, ClientSession session, JsonObject filter) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.filter- the given filter. It may benull.- Returns:
- The list of objects.
- Since:
- 1.4
-
find
public static CompletionStage<List<JsonObject>> find(MongoCollection<Document> collection, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds all JSON objects.- Parameters:
collection- the MongoDB collection.setParameters- a function to set the parameters for the result set.- Returns:
- The list of objects.
- Since:
- 2.0
-
find
public static CompletionStage<List<JsonObject>> find(MongoCollection<Document> collection, Bson filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.filter- the given filter. It may benull.setParameters- a function to set the parameters for the result set.- Returns:
- The list of objects.
- Since:
- 1.4
-
find
public static CompletionStage<List<JsonObject>> find(MongoCollection<Document> collection, JsonObject filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.filter- the given filter. It may benull.setParameters- a function to set the parameters for the result set.- Returns:
- The list of objects.
- Since:
- 1.4
-
find
public static CompletionStage<List<JsonObject>> find(MongoCollection<Document> collection, ClientSession session, Bson filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.filter- the given filter. It may benull.setParameters- a function to set the parameters for the result set.- Returns:
- The list of objects.
- Since:
- 1.4
-
find
public static CompletionStage<List<JsonObject>> find(MongoCollection<Document> collection, ClientSession session, JsonObject filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.filter- the given filter. It may benull.setParameters- a function to set the parameters for the result set.- Returns:
- The list of objects.
- Since:
- 1.4
-
findPublisher
Finds all JSON objects.- Parameters:
collection- the MongoDB collection.- Returns:
- The object publisher.
- Since:
- 2.0
-
findPublisher
public static Flow.Publisher<JsonObject> findPublisher(MongoCollection<Document> collection, Bson filter) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.filter- the given filter. It may benull.- Returns:
- The object publisher.
- Since:
- 1.4
-
findPublisher
public static Flow.Publisher<JsonObject> findPublisher(MongoCollection<Document> collection, JsonObject filter) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.filter- the given filter. It may benull.- Returns:
- The object publisher.
- Since:
- 1.4
-
findPublisher
public static Flow.Publisher<JsonObject> findPublisher(MongoCollection<Document> collection, ClientSession session, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds all JSON objects.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.setParameters- a function to set the parameters for the result set.- Returns:
- The object publisher.
- Since:
- 2.0
-
findPublisher
public static Flow.Publisher<JsonObject> findPublisher(MongoCollection<Document> collection, ClientSession session) Finds all JSON objects.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.- Returns:
- The object publisher.
- Since:
- 2.0
-
findPublisher
public static Flow.Publisher<JsonObject> findPublisher(MongoCollection<Document> collection, ClientSession session, Bson filter) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.filter- the given filter. It may benull.- Returns:
- The object publisher.
- Since:
- 2.0
-
findPublisher
public static Flow.Publisher<JsonObject> findPublisher(MongoCollection<Document> collection, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.setParameters- a function to set the parameters for the result set.- Returns:
- The object publisher.
- Since:
- 2.0
-
findPublisher
public static Flow.Publisher<JsonObject> findPublisher(MongoCollection<Document> collection, Bson filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.filter- the given filter. It may benull.setParameters- a function to set the parameters for the result set.- Returns:
- The object publisher.
- Since:
- 1.4
-
findPublisher
public static Flow.Publisher<JsonObject> findPublisher(MongoCollection<Document> collection, JsonObject filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.filter- the given filter. It may benull.setParameters- a function to set the parameters for the result set.- Returns:
- The object publisher.
- Since:
- 1.4
-
findPublisher
public static Flow.Publisher<JsonObject> findPublisher(MongoCollection<Document> collection, ClientSession session, Bson filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.filter- the given filter. It may benull.setParameters- a function to set the parameters for the result set.- Returns:
- The object publisher.
- Since:
- 1.4
-
findPublisher
public static Flow.Publisher<JsonObject> findPublisher(MongoCollection<Document> collection, ClientSession session, JsonObject filter, UnaryOperator<FindPublisher<BsonDocument>> setParameters) Finds JSON objects that matchfilter.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.filter- the given filter. It may benull.setParameters- a function to set the parameters for the result set.- Returns:
- The object publisher.
- Since:
- 1.4
-
findOne
public static CompletionStage<Optional<JsonObject>> findOne(MongoCollection<Document> collection, Bson filter) Finds a JSON object. Only one should match thefilter, otherwise the result will be empty.- Parameters:
collection- the MongoDB collection.filter- the given filter.- Returns:
- The optional result.
- Since:
- 1.4
-
findOne
public static CompletionStage<Optional<JsonObject>> findOne(MongoCollection<Document> collection, JsonObject filter) Finds a JSON object. Only one should match thefilter, otherwise the result will be empty.- Parameters:
collection- the MongoDB collection.filter- the given filter.- Returns:
- The optional result.
- Since:
- 1.4
-
findOne
public static CompletionStage<Optional<JsonObject>> findOne(MongoCollection<Document> collection, ClientSession session, Bson filter) Finds a JSON object. Only one should match thefilter, otherwise the result will be empty.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.filter- the given filter.- Returns:
- The optional result.
- Since:
- 1.4
-
findOne
public static CompletionStage<Optional<JsonObject>> findOne(MongoCollection<Document> collection, ClientSession session, JsonObject filter) Finds a JSON object. Only one should match thefilter, otherwise the result will be empty.- Parameters:
collection- the MongoDB collection.session- the MongoDB session.filter- the given filter.- Returns:
- The optional result.
- Since:
- 1.4
-
insert
public static CompletionStage<Boolean> insert(MongoCollection<Document> collection, JsonObject json) Inserts thecollectionwithjson.- Parameters:
collection- the MongoDB collection.json- the given JSON Event Sourcing object, which can be an aggregate, event or a command.- Returns:
- Whether the update was successful or not.
- Since:
- 1.4
-
insert
public static CompletionStage<Boolean> insert(MongoCollection<Document> collection, JsonObject json, ClientSession session) Inserts thecollectionwithjson.- Parameters:
collection- the MongoDB collection.json- the given JSON Event Sourcing object, which can be an aggregate, event or a command.session- the MongoDB session.- Returns:
- Whether the update was successful or not.
- Since:
- 1.4
-
patch
Returns the stream of operation objects for a JSON patch.- Parameters:
source- the source JSON object.target- the target JSON object.- Returns:
- The operation stream.
- Since:
- 2.1.1
-
patch
Returns the stream of operation objects for a JSON patch.- Parameters:
patch- the JSON patch.- Returns:
- The operation stream.
- Since:
- 2.1.1
-
update
public static CompletionStage<Boolean> update(MongoCollection<Document> collection, JsonObject json, String id) Updates thecollectionwithjson. If the object doesn't exist yet it is inserted.- Parameters:
collection- the MongoDB collection.json- the given JSON Event Sourcing object, which can be an aggregate, event or a command.id- the identifier for the object.- Returns:
- Whether the update was successful or not.
- Since:
- 1.4
-
update
public static CompletionStage<Boolean> update(MongoCollection<Document> collection, JsonObject json) Updates thecollectionwithjson. If the object doesn't exist yet it is inserted. The field_idinjsonis used as the key.- Parameters:
collection- the MongoDB collection.json- the given JSON Event Sourcing object, which can be an aggregate, event or a command.- Returns:
- Whether the update was successful or not.
- Since:
- 1.4
-
update
public static CompletionStage<Boolean> update(MongoCollection<Document> collection, JsonObject json, String id, ClientSession session) Updates thecollectionwithjson. If the object doesn't exist yet it is inserted.- Parameters:
collection- the MongoDB collection.json- the given JSON Event Sourcing object, which can be an aggregate, event or a command.id- the identifier for the object.session- the MongoDB session.- Returns:
- Whether the update was successful or not.
- Since:
- 1.4
-
update
public static CompletionStage<Boolean> update(MongoCollection<Document> collection, JsonObject json, ClientSession session) Updates thecollectionwithjson. If the object doesn't exist yet it is inserted. The field_idinjsonis used as the key.- Parameters:
collection- the MongoDB collection.json- the given JSON Event Sourcing object, which can be an aggregate, event or a command.session- the MongoDB session.- Returns:
- Whether the update was successful or not.
- Since:
- 1.4
-
update
public static CompletionStage<Boolean> update(MongoCollection<Document> collection, JsonObject json, JsonValue id, ClientSession session) Updates thecollectionwithjson. If the object doesn't exist yet it is inserted.- Parameters:
collection- the MongoDB collection.json- the given JSON Event Sourcing object, which can be an aggregate, event or a command.id- the identifier for the object.session- the MongoDB session.- Returns:
- Whether the update was successful or not.
- Since:
- 1.4
-
update
public static CompletionStage<Boolean> update(MongoCollection<Document> collection, JsonObject source, JsonObject target) Updates thecollectionwithtarget, but with a bulk write containing only the differences withsource.- Parameters:
collection- the MongoDB collection.source- the old version of the object.target- the new version of the object.- Returns:
- Whether the update was successful or not.
- Since:
- 2.1.1
-
watch
Returns the changes that occur in a collection.- Parameters:
collection- the given collection.- Returns:
- The publisher with the changed documents.
- Since:
- 4.2
-