rishabhdaim commented on code in PR #920:
URL: https://github.com/apache/jackrabbit-oak/pull/920#discussion_r1200650796


##########
oak-store-document/src/main/java/org/apache/jackrabbit/oak/plugins/document/mongo/MongoDocumentStore.java:
##########
@@ -1147,6 +1155,85 @@ private <T extends Document> T 
findAndModify(Collection<T> collection,
         }
     }
 
+    /**
+     * Performs a conditional update (e.g. using
+     * {@link Condition.Type#EXISTS} and only update the
+     * document if the condition is <code>true</code>. The returned documents 
are
+     * immutable.
+     * <p>
+     * In case of a {@code DocumentStoreException} (e.g. when a communication
+     * error occurs) only some updates may have been applied. In this case
+     * it is the responsibility of the caller to check which {@link UpdateOp}s
+     * were applied and take appropriate action. The implementation however 
ensures
+     * that the result of the operations are properly reflected in the document
+     * cache. That is, an implementation could simply evict the documents 
related
+     * to the given update operations from the cache.
+     *
+     * @param collection the collection
+     * @param updateOps  the update operation List
+     * @return the list containing old documents or <code>null</code> if the 
condition is not met
+     * or if the document wasn't found. The order in the result list reflects 
the order
+     * in the updateOps parameter
+     * @throws DocumentStoreException if the operation failed. E.g. because of
+     *                                an I/O error.
+     * @see #createOrUpdate(Collection, List)
+     */
+    @Override
+    @NotNull
+    public <T extends Document> List<T> findAndUpdate(final @NotNull 
Collection<T> collection, final @NotNull List<UpdateOp> updateOps) {

Review Comment:
   I have updated the code to merge `sendBulkModify` and `sendBulkUpdate` into 
one method `sendBulkRequest` and used boolean flags to handle upsert & modify 
requests.
   
   Also, One internal class `BulkUpdateResult` had been modified to 
`BulkRequestResult` to handle both upsert & modify requests.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to