Author: mreutegg
Date: Mon Sep 30 11:58:50 2019
New Revision: 1867767

URL: http://svn.apache.org/viewvc?rev=1867767&view=rev
Log:
OAK-8655: List changes for revisions

Modified:
    jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js

Modified: jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js?rev=1867767&r1=1867766&r2=1867767&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js (original)
+++ jackrabbit/oak/trunk/oak-run/src/main/js/oak-mongo.js Mon Sep 30 11:58:50 
2019
@@ -29,6 +29,30 @@ var oak = (function(global){
     };
 
     /**
+     * Prints all ids of documents in the nodes collection that contain changes
+     * with the given revisions. Example:
+     * <p>
+     * <pre>oak.changesForRevisions({'r16d63f52ff7-0-1':1, 
'r16d63f5b605-0-1':1})</pre>
+     * <p>
+     * Caution: this method scans the entire nodes collection and will most
+     * likely impact performance of the application using the database. Do
+     * <b>NOT</b> run this method on a production system!
+     *
+     * @memberof oak
+     * @method oak.changesForRevisions
+     */
+    api.changesForRevisions = function(revs) {
+        revs = revs || {};
+        db.nodes.find({}, {_id:1,_revisions:1, 
_commitRoot:1}).forEach(function(doc) {
+            for (var r in revs) {
+                if (doc._revisions && doc._revisions[r] || doc._commitRoot && 
doc._commitRoot[r]) {
+                    print(doc._id);
+                }
+            }
+        });
+    };
+
+    /**
      * Collects various stats related to Oak usage of Mongo.
      *
      * @memberof oak


Reply via email to