You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Joscorbe (via GitHub)" <gi...@apache.org> on 2024/05/13 13:05:31 UTC

[PR] OAK-10798: Introduce functions to clean nodes based on regular expression [jackrabbit-oak]

Joscorbe opened a new pull request, #1448:
URL: https://github.com/apache/jackrabbit-oak/pull/1448

   (no comment)


-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-10798: Introduce functions to clean nodes based on regular expression [jackrabbit-oak]

Posted by "Joscorbe (via GitHub)" <gi...@apache.org>.
Joscorbe commented on code in PR #1448:
URL: https://github.com/apache/jackrabbit-oak/pull/1448#discussion_r1598623984


##########
oak-run/src/main/js/oak-mongo.js:
##########
@@ -329,6 +329,59 @@ var oak = (function(global){
         return {nRemoved : count};
     };
 
+    /**
+     * Helper method to find nodes based on Regular Expression.
+     *
+     * @memberof oak
+     * @method regexFind
+     * @param {string} pattern the pattern to match the nodes.
+     */
+	api.regexFind = function(pattern) {
+		print(db.nodes.find({_id: {$regex: pattern}}));
+		db.nodes.find({_id: {$regex: pattern}}).forEach(function(doc) {
+			print(doc._id);
+        });
+	}
+
+    /**
+     * Remove the complete subtree of all the nodes matching a regex pattern.
+     * Use regexFind to find the nodes that match the pattern prior deletion.
+     *
+     * @memberof oak
+     * @method removeDescendantsMatching
+     * @param {string} pattern the pattern to match the nodes to be removed.
+     */
+    api.removeDescendantsMatching = function(pattern) {

Review Comment:
   Done



-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-10798: Introduce functions to clean nodes based on regular expression [jackrabbit-oak]

Posted by "stefan-egli (via GitHub)" <gi...@apache.org>.
stefan-egli commented on code in PR #1448:
URL: https://github.com/apache/jackrabbit-oak/pull/1448#discussion_r1598514554


##########
oak-run/src/main/js/oak-mongo.js:
##########
@@ -329,6 +329,59 @@ var oak = (function(global){
         return {nRemoved : count};
     };
 
+    /**
+     * Helper method to find nodes based on Regular Expression.
+     *
+     * @memberof oak
+     * @method regexFind
+     * @param {string} pattern the pattern to match the nodes.
+     */
+	api.regexFind = function(pattern) {

Review Comment:
   indenting is not beautified (tabs instead of spaces)



##########
oak-run/src/main/js/oak-mongo.js:
##########
@@ -329,6 +329,59 @@ var oak = (function(global){
         return {nRemoved : count};
     };
 
+    /**
+     * Helper method to find nodes based on Regular Expression.
+     *
+     * @memberof oak
+     * @method regexFind
+     * @param {string} pattern the pattern to match the nodes.
+     */
+	api.regexFind = function(pattern) {
+		print(db.nodes.find({_id: {$regex: pattern}}));
+		db.nodes.find({_id: {$regex: pattern}}).forEach(function(doc) {
+			print(doc._id);
+        });
+	}
+
+    /**
+     * Remove the complete subtree of all the nodes matching a regex pattern.
+     * Use regexFind to find the nodes that match the pattern prior deletion.
+     *
+     * @memberof oak
+     * @method removeDescendantsMatching
+     * @param {string} pattern the pattern to match the nodes to be removed.
+     */
+    api.removeDescendantsMatching = function(pattern) {

Review Comment:
   ```suggestion
       api.removeDescendantsAndSelfMatching = function(pattern) {
   ```
   
   naming : should we use a similar name to `removeDescendantsAndSelf` to stress that `self` will also be deleted?



-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] OAK-10798: Introduce functions to clean nodes based on regular expression [jackrabbit-oak]

Posted by "Joscorbe (via GitHub)" <gi...@apache.org>.
Joscorbe merged PR #1448:
URL: https://github.com/apache/jackrabbit-oak/pull/1448


-- 
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: dev-unsubscribe@jackrabbit.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org