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-unsubscr...@jackrabbit.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org