Skip to content

Commit

Permalink
OAK-8655: List changes for revisions
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/jackrabbit/oak/trunk@1867767 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mreutegg committed Sep 30, 2019
1 parent 635e026 commit c78ed7e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions oak-run/src/main/js/oak-mongo.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,30 @@ var oak = (function(global){
print("Oak Mongo Helpers");
};

/**
* 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.
*
Expand Down

0 comments on commit c78ed7e

Please sign in to comment.