jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mreut...@apache.org
Subject svn commit: r1666141 [1/2] - in /jackrabbit/site/live/oak/docs/oak-mongo-js: ./ scripts/ scripts/prettify/ styles/
Date Thu, 12 Mar 2015 11:14:51 GMT
Author: mreutegg
Date: Thu Mar 12 11:14:50 2015
New Revision: 1666141

URL: http://svn.apache.org/r1666141
Log:
OAK-2500: checkDeepHistory/fixDeepHistory/prepareDeepHistory for oak-mongo.js

Update oak-mongo.js documentation

Added:
    jackrabbit/site/live/oak/docs/oak-mongo-js/
    jackrabbit/site/live/oak/docs/oak-mongo-js/index.html   (with props)
    jackrabbit/site/live/oak/docs/oak-mongo-js/oak-mongo.js.html   (with props)
    jackrabbit/site/live/oak/docs/oak-mongo-js/oak.html   (with props)
    jackrabbit/site/live/oak/docs/oak-mongo-js/scripts/
    jackrabbit/site/live/oak/docs/oak-mongo-js/scripts/linenumber.js   (with props)
    jackrabbit/site/live/oak/docs/oak-mongo-js/scripts/prettify/
    jackrabbit/site/live/oak/docs/oak-mongo-js/scripts/prettify/Apache-License-2.0.txt   (with props)
    jackrabbit/site/live/oak/docs/oak-mongo-js/scripts/prettify/lang-css.js   (with props)
    jackrabbit/site/live/oak/docs/oak-mongo-js/scripts/prettify/prettify.js   (with props)
    jackrabbit/site/live/oak/docs/oak-mongo-js/styles/
    jackrabbit/site/live/oak/docs/oak-mongo-js/styles/jsdoc-default.css   (with props)
    jackrabbit/site/live/oak/docs/oak-mongo-js/styles/prettify-jsdoc.css   (with props)
    jackrabbit/site/live/oak/docs/oak-mongo-js/styles/prettify-tomorrow.css   (with props)

Added: jackrabbit/site/live/oak/docs/oak-mongo-js/index.html
URL: http://svn.apache.org/viewvc/jackrabbit/site/live/oak/docs/oak-mongo-js/index.html?rev=1666141&view=auto
==============================================================================
--- jackrabbit/site/live/oak/docs/oak-mongo-js/index.html (added)
+++ jackrabbit/site/live/oak/docs/oak-mongo-js/index.html Thu Mar 12 11:14:50 2015
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <title>JSDoc: Index</title>
+    
+    <script src="scripts/prettify/prettify.js"> </script>
+    <script src="scripts/prettify/lang-css.js"> </script>
+    <!--[if lt IE 9]>
+      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
+    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
+</head>
+
+<body>
+
+<div id="main">
+    
+    <h1 class="page-title">Index</h1>
+    
+    
+
+
+    
+
+
+    <h3> </h3>
+
+
+
+
+
+
+
+
+
+    
+
+
+
+
+
+
+
+
+
+</div>
+
+<nav>
+    <h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="oak.html">oak</a></li></ul>
+</nav>
+
+<br clear="both">
+
+<footer>
+    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.3-dev</a> on Thu Mar 12 2015 12:09:19 GMT+0100 (CET)
+</footer>
+
+<script> prettyPrint(); </script>
+<script src="scripts/linenumber.js"> </script>
+</body>
+</html>
\ No newline at end of file

Propchange: jackrabbit/site/live/oak/docs/oak-mongo-js/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/site/live/oak/docs/oak-mongo-js/oak-mongo.js.html
URL: http://svn.apache.org/viewvc/jackrabbit/site/live/oak/docs/oak-mongo-js/oak-mongo.js.html?rev=1666141&view=auto
==============================================================================
--- jackrabbit/site/live/oak/docs/oak-mongo-js/oak-mongo.js.html (added)
+++ jackrabbit/site/live/oak/docs/oak-mongo-js/oak-mongo.js.html Thu Mar 12 11:14:50 2015
@@ -0,0 +1,954 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <title>JSDoc: Source: oak-mongo.js</title>
+    
+    <script src="scripts/prettify/prettify.js"> </script>
+    <script src="scripts/prettify/lang-css.js"> </script>
+    <!--[if lt IE 9]>
+      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
+    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
+</head>
+
+<body>
+
+<div id="main">
+    
+    <h1 class="page-title">Source: oak-mongo.js</h1>
+    
+    
+
+
+    
+    <section>
+        <article>
+            <pre class="prettyprint source"><code>/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+/*global print, _, db, Object, ObjectId */
+
+/** @namespace */
+var oak = (function(global){
+    "use strict";
+
+    var api;
+
+    api = function(){
+        print("Oak Mongo Helpers");
+    };
+
+    /**
+     * Collects various stats related to Oak usage of Mongo.
+     *
+     * @memberof oak
+     * @method oak.systemStats
+     * @returns {object} system stats.
+     */
+    api.systemStats = function () {
+        var result = {};
+        result.nodeStats = db.nodes.stats(1024 * 1024);
+        result.blobStats = db.blobs.stats(1024 * 1024);
+        result.clusterStats = db.clusterNodes.find().toArray();
+        result.oakIndexes = db.nodes.find({'_id': /^2\:\/oak\:index\//}).toArray();
+        result.hostInfo = db.hostInfo();
+        result.rootDoc = db.nodes.findOne({'_id' : '0:/'});
+        return result;
+    };
+
+    /**
+     * Collects various stats related to Oak indexes stored under /oak:index.
+     *
+     * @memberof oak
+     * @method indexStats
+     * @returns {Array} index stats.
+     */
+    api.indexStats = function () {
+        var result = [];
+        var totalCount = 0;
+        var totalSize = 0;
+        db.nodes.find({'_id': /^2\:\/oak\:index\//}, {_id: 1}).forEach(function (doc) {
+            var stats = api.getChildStats(api.pathFromId(doc._id));
+            stats.id = doc._id;
+            result.push(stats);
+
+            totalCount += stats.count;
+            totalSize += stats.size;
+        });
+
+        result.push({id: "summary", count: totalCount, size: totalSize, "simple": humanFileSize(totalSize)});
+        return result;
+    };
+
+    /**
+     * Determines the number of child node (including all sub tree)
+     * for a given parent node path. This would be faster compared to
+     * {@link getChildStats} as it does not load the doc and works on
+     * index only.
+     *
+     * Note that there might be some difference between db.nodes.count()
+     * and countChildren('/') as split docs, intermediate docs are not
+     * accounted for
+     *
+     * @memberof oak
+     * @method countChildren
+     * @param {string} path the path of a node.
+     * @returns {number} the number of children, including all descendant nodes.
+     */
+    api.countChildren = function(path){
+        var depth = pathDepth(path);
+        var totalCount = 0;
+        while (true) {
+            var count = db.nodes.count({_id: pathFilter(depth++, path)});
+            if( count === 0){
+                break;
+            }
+            totalCount += count;
+        }
+        return totalCount;
+    };
+
+    /**
+     * Provides stats related to number of child nodes
+     * below given path or total size taken by such nodes.
+     *
+     * @memberof oak
+     * @method getChildStats
+     * @param {string} path the path of a node.
+     * @returns {{count: number, size: number}} statistics about the child nodes
+     *          including all descendants.
+     */
+    api.getChildStats = function(path){
+        var count = 0;
+        var size = 0;
+        this.forEachChild(path, function(doc){
+            count++;
+            size +=  Object.bsonsize(doc);
+        });
+        return {"count" : count, "size" : size, "simple" : humanFileSize(size)};
+    };
+
+    /**
+     * Performs a breadth first traversal for nodes under given path
+     * and invokes the passed function for each child node.
+     *
+     * @memberof oak
+     * @method forEachChild
+     * @param {string} path the path of a node.
+     * @param callable a function to be called for each child node including all
+     *        descendant nodes. The MongoDB document is passed as the single
+     *        parameter of the function.
+     */
+    api.forEachChild = function(path, callable) {
+        var depth = pathDepth(path);
+        while (true) {
+            var cur = db.nodes.find({_id: pathFilter(depth++, path)});
+            if(!cur.hasNext()){
+                break;
+            }
+            cur.forEach(callable);
+        }
+    };
+
+    /**
+     * Returns the path part of the given id.
+     *
+     * @memberof oak
+     * @method pathFromId
+     * @param {string} id the id of a Document in the nodes collection.
+     * @returns {string} the path derived from the id.
+     */
+    api.pathFromId = function(id) {
+        var index = id.indexOf(':');
+        return id.substring(index + 1);
+    };
+
+    /**
+     * Checks the _lastRev for a given clusterId. The checks starts with the
+     * given path and walks up to the root node.
+     *
+     * @memberof oak
+     * @method checkLastRevs
+     * @param {string} path the path of a node to check
+     * @param {number} clusterId the id of an oak cluster node.
+     * @returns {object} the result of the check.
+     */
+    api.checkLastRevs = function(path, clusterId) {
+        return checkOrFixLastRevs(path, clusterId, true);
+    };
+
+    /**
+     * Fixes the _lastRev for a given clusterId. The fix starts with the
+     * given path and walks up to the root node.
+     *
+     * @memberof oak
+     * @method fixLastRevs
+     * @param {string} path the path of a node to fix
+     * @param {number} clusterId the id of an oak cluster node.
+     * @returns {object} the result of the fix.
+     */
+    api.fixLastRevs = function(path, clusterId) {
+        return checkOrFixLastRevs(path, clusterId, false);
+    };
+
+    /**
+     * Returns statistics about the blobs collection in the current database.
+     * The stats include the combined BSON size of all documents. The time to
+     * run this command therefore heavily depends on the size of the collection.
+     *
+     * @memberof oak
+     * @method blobStats
+     * @returns {object} statistics about the blobs collection.
+     */
+    api.blobStats = function() {
+        var result = {};
+        var stats = db.blobs.stats(1024 * 1024);
+        var bsonSize = 0;
+        db.blobs.find().forEach(function(doc){bsonSize += Object.bsonsize(doc)});
+        result.count = stats.count;
+        result.size = stats.size;
+        result.storageSize = stats.storageSize;
+        result.bsonSize = Math.round(bsonSize / (1024 * 1024));
+        result.indexSize = stats.totalIndexSize;
+        return result;
+    };
+
+    /**
+     * Converts the given Revision String into a more human readable version,
+     * which also prints the date.
+     *
+     * @memberof oak
+     * @method formatRevision
+     * @param {string} rev a revision string.
+     * @returns {string} a human readable string representation of the revision.
+     */
+    api.formatRevision = function(rev) {
+        return new Revision(rev).toReadableString();
+    };
+
+    /**
+     * Removes the complete subtree rooted at the given path.
+     *
+     * @memberof oak
+     * @method removeDescendantsAndSelf
+     * @param {string} path the path of the subtree to remove.
+     */
+    api.removeDescendantsAndSelf = function(path) {
+        var count = 0;
+        var depth = pathDepth(path);
+        var id = depth + ":" + path;
+        // current node at path
+        var result = db.nodes.remove({_id: id});
+        count += result.nRemoved;
+        // might be a long path
+        result = db.nodes.remove(longPathQuery(path));
+        count += result.nRemoved;
+        // descendants
+        var prefix = path + "/";
+        depth++;
+        while (true) {
+            result = db.nodes.remove(longPathFilter(depth, prefix));
+            count += result.nRemoved;
+            result = db.nodes.remove({_id: pathFilter(depth++, prefix)});
+            count += result.nRemoved;
+            if (result.nRemoved == 0) {
+                break;
+            }
+        }
+        // descendants further down the hierarchy with long path
+        while (true) {
+            result = db.nodes.remove(longPathFilter(depth++, prefix));
+            if (result.nRemoved == 0) {
+                break;
+            }
+            count += result.nRemoved;
+        }
+        return {nRemoved : count};
+    };
+
+    /**
+     * List all checkpoints.
+     *
+     * @memberof oak
+     * @method listCheckpoints
+     * @returns {object} all checkpoints
+     */
+    api.listCheckpoints = function() {
+        var result = {};
+        var doc = db.settings.findOne({_id:"checkpoint"});
+        if (doc == null) {
+            print("No checkpoint document found.");
+            return;
+        }
+        var data = doc.data;
+        var r;
+        for (r in data) {
+            var rev = new Revision(r);
+            var exp;
+            if (data[r].charAt(0) == '{') {
+                exp = JSON.parse(data[r])["expires"];
+            } else {
+                exp = data[r];
+            }
+            result[r] = {created:rev.asDate(), expires:new Date(parseInt(exp, 10))};
+        }
+        return result;
+    };
+
+    /**
+     * Removes all checkpoints older than a given Revision.
+     *
+     * @memberof oak
+     * @method removeCheckpointsOlderThan
+     * @param {string} rev checkpoints older than this revision are removed.
+     * @returns {object} the result of the MongoDB update.
+     */
+    api.removeCheckpointsOlderThan = function(rev) {
+        if (rev === undefined) {
+            print("No revision specified");
+            return;
+        }
+        var r = new Revision(rev);
+        var unset = {};
+        var cps = api.listCheckpoints();
+        var x;
+        var num = 0;
+        for (x in cps) {
+            if (r.isNewerThan(new Revision(x))) {
+                unset["data." + x] = "";
+                num++;
+            }
+        }
+        if (num > 0) {
+            var update = {};
+            update["$inc"] = {_modCount: NumberLong(1)};
+            update["$unset"] = unset;
+            return db.settings.update({_id:"checkpoint"}, update);
+        } else {
+            print("No checkpoint older than " + rev);
+        }
+    };
+
+    /**
+     * Removes all collision markers on the document with the given path and
+     * clusterId. This method will only remove collisions when the clusterId
+     * is inactive.
+     *
+     * @memberof oak
+     * @method removeCollisions
+     * @param {string} path the path of a document
+     * @param {number} clusterId collision markers for this clusterId will be removed.
+     * @returns {object} the result of the MongoDB update.
+     */
+    api.removeCollisions = function(path, clusterId) {
+        if (path === undefined) {
+            print("No path specified");
+            return;
+        }
+        if (clusterId === undefined) {
+            print("No clusterId specified");
+            return;
+        }
+        // refuse to remove when clusterId is marked active
+        var clusterNode = db.clusterNodes.findOne({_id: clusterId.toString()});
+        if (clusterNode && clusterNode.state == "ACTIVE") {
+            print("Cluster node with id " + clusterId + " is active!");
+            print("Can only remove collisions for inactive cluster node.");
+            return;
+        }
+
+        var doc = this.findOne(path);
+        if (!doc) {
+            print("No document for path: " + path);
+            return;
+        }
+        var unset = {};
+        var r;
+        var num = 0;
+        for (r in doc._collisions) {
+            if (new Revision(r).getClusterId() == clusterId) {
+                unset["_collisions." + r] = "";
+                num++;
+            }
+        }
+        if (num > 0) {
+            var update = {};
+            update["$inc"] = {_modCount: NumberLong(1)};
+            update["$unset"] = unset;
+            return db.nodes.update({_id: pathDepth(path) + ":" + path}, update);
+        } else {
+            print("No collisions found for clusterId " + clusterId);
+        }
+    };
+
+    /**
+     * Finds the document with the given path.
+     *
+     * @memberof oak
+     * @method findOne
+     * @param {string} path the path of the document.
+     * @returns {object} the document or null if it doesn't exist.
+     */
+    api.findOne = function(path) {
+        if (path === undefined) {
+            return null;
+        }
+        return db.nodes.findOne({_id: pathDepth(path) + ":" + path});
+    };
+
+    /**
+     * Checks the history of previous documents at the given path. Orphaned
+     * references to removed previous documents are counted and listed when
+     * run with verbose set to true.
+     *
+     * @memberof oak
+     * @method checkHistory
+     * @param {string} path the path of the document.
+     * @param {boolean} [verbose=false] if true, the result object will contain a list
+     *        of dangling references to previous documents.
+     * @param {boolean} [ignorePathLen=false] whether to ignore a long path and
+     *        still try to read it from MongoDB.
+     * @returns {object} the result of the check.
+     */
+    api.checkHistory = function(path, verbose, ignorePathLen) {
+        return checkOrFixHistory(path, false, verbose, ignorePathLen);
+    };
+
+    /**
+     * Lists the descendant documents at a given path.
+     *
+     * @memberof oak
+     * @method listDescendants
+     * @param {string} path list the descendants of the document with this path.
+     */
+    api.listDescendants = function(path) {
+        if (path === undefined) {
+            return null;
+        }
+        var numDescendants = 0;
+        print("Listing descendants for "+path);
+        this.forEachChild(path, function(aChild) {
+            print(api.pathFromId(aChild._id));
+            numDescendants++;
+        });
+        print("Found " + numDescendants + " descendants");
+    };
+
+    /**
+     * Lists the children at a given path.
+     *
+     * @memberof oak
+     * @method listChildren
+     * @param {string} path list the children of the document with this path.
+     */
+    api.listChildren = function(path) {
+        if (path === undefined) {
+            return null;
+        }
+        var numChildren = 0;
+        print("Listing children for "+path);
+        var prefix;
+        if (path == "/") {
+            prefix = path;
+        } else {
+            prefix = path + "/";
+        }
+        db.nodes.find({_id: pathFilter(pathDepth(path) + 1, prefix)}).forEach(function(doc) {
+            print(api.pathFromId(doc._id));
+            numChildren++;
+        });
+        print("Found " + numChildren + " children");
+    };
+
+    /**
+     * Same as checkHistory except it goes through ALL descendants as well!
+     *
+     * @memberof oak
+     * @method checkDeepHistory
+     * @param {string} path the path of the document.
+     * @param {boolean} [verbose=false] if true, the result object will contain a list
+     *        of dangling references to previous documents.
+     */
+    api.checkDeepHistory = function(path, verbose) {
+        checkOrFixDeepHistory(path, false, false, verbose);
+    };
+
+    /**
+     * Preparation step which scans through all descendants and prints out
+     * 'fixHistory' for those that need fixing of their 'dangling references'.
+     * &lt;p>
+     * See fixHistory for parameter details.
+     * &lt;p>
+     * Run this command via something as follows:
+     * &lt;p>
+     *  mongo &lt;DBNAME> -eval "load('oak-mongo.js'); oak.prepareDeepHistory('/');" > fix.js
+     *
+     * @memberof oak
+     * @method prepareDeepHistory
+     * @param {string} path the path of a document.
+     * @param {boolean} [verbose=false] if true, the result object will contain a list
+     *        of dangling references to previous documents.
+     */
+    api.prepareDeepHistory = function(path, verbose) {
+        checkOrFixDeepHistory(path, false, true, verbose);
+    };
+
+    /**
+     * Same as fixHistory except it goes through ALL descendants as well!
+     *
+     * @memberof oak
+     * @method fixDeepHistory
+     * @param {string} path the path of the document.
+     * @param {boolean} [verbose=false] if true, the result object will contain a list
+     *        of removed references to previous documents.
+     */
+    api.fixDeepHistory = function(path, verbose) {
+        checkOrFixDeepHistory(path, true, false, verbose);
+    };
+
+    /**
+     * Repairs the history of previous documents at the given path. Orphaned
+     * references to removed previous documents are cleaned up and listed when
+     * run with verbose set to true.
+     *
+     * @memberof oak
+     * @method fixHistory
+     * @param {string} path the path of the document.
+     * @param {boolean} [verbose=false] if true, the result object will contain a list
+     *        of removed references to previous documents.
+     * @returns {object} the result of the fix.
+     */
+    api.fixHistory = function(path, verbose) {
+        return checkOrFixHistory(path, true, verbose, true);
+    };
+
+    /**
+     * Returns the commit value entry for the change with the given revision.
+     *
+     * @memberof oak
+     * @method getCommitValue
+     * @param {string} path the path of a document.
+     * @param {string} revision the revision of a change on the document.
+     * @returns {object} the commit entry for the given revision or null if
+     *          there is none.
+     */
+    api.getCommitValue = function(path, revision) {
+        var doc = this.findOne(path);
+        if (!doc) {
+            return null;
+        }
+        if (revision === undefined) {
+            print("No revision specified");
+        }
+        // check _revisions
+        var entry = getRevisionEntry(doc, path, revision);
+        if (entry) {
+            return entry;
+        }
+
+        // get commit root
+        entry = getEntry(doc, "_commitRoot", revision);
+        if (!entry) {
+            var prev = findPreviousDocument(path, "_commitRoot", revision);
+            if (prev) {
+                entry = getEntry(prev, "_commitRoot", revision);
+            }
+        }
+        if (!entry) {
+            return null;
+        }
+        var commitRootPath = getCommitRootPath(path, parseInt(entry[revision]));
+        doc = this.findOne(commitRootPath);
+        if (!doc) {
+            return null;
+        }
+        return getRevisionEntry(doc, commitRootPath, revision);
+    };
+    
+    //~--------------------------------------------------&lt; internal >
+
+    var checkOrFixDeepHistory = function(path, fix, prepare, verbose) {
+        if (prepare) {
+            // not issuing any header at all
+        } else if (fix) {
+            print("Fixing   "+path+" plus all descendants...");
+        } else {
+            print("Checking "+path+" plus all descendants...");
+        }
+        var count = 0;
+        var ignored = 0;
+        var affected = 0;
+        api.forEachChild(path, function(aChild) {
+            var p = api.pathFromId(aChild._id);
+            var result = checkOrFixHistory(p, fix, verbose, true);
+            if (result) {
+                if (prepare) {
+                    var numDangling = result.numPrevLinksDangling;
+                    if (numDangling!=0) {
+                        print("oak.fixHistory('"+p+"');");
+                        affected++;
+                    }
+                } else if (fix) {
+                    var numDangling = result.numPrevLinksRemoved;
+                    if (numDangling!=0) {
+                        print(" - path: "+p+" removed "+numDangling+" dangling previous revisions");
+                        affected++;
+                    }
+                } else {
+                    var numDangling = result.numPrevLinksDangling;
+                    if (numDangling!=0) {
+                        print(" - path: "+p+" has "+numDangling+" dangling previous revisions");
+                        affected++;
+                    }
+                }
+                if (!prepare && (++count%10000==0)) {
+                    print("[checked "+count+" so far ("+affected+" affected, "+ignored+" ignored) ...]");
+                }
+            } else {
+                if (!prepare) {
+                    print(" - could not handle "+p);
+                }
+                ignored++;
+            }
+        });
+        if (!prepare) {
+            print("Total: "+count+" handled, "+affected+" affected, "+ignored+" ignored (path too long)");
+            print("done.");
+        }
+    };
+
+    var getRevisionEntry = function (doc, path, revision) {
+        var entry = getEntry(doc, "_revisions", revision);
+        if (entry) {
+            return entry;
+        }
+        var prev = findPreviousDocument(path, "_revisions", revision);
+        if (prev) {
+            entry = getEntry(prev, "_revisions", revision);
+            if (entry) {
+                return entry;
+            }
+        }
+    };
+    
+    var getCommitRootPath = function(path, depth) {
+        if (depth == 0) {
+            return "/";
+        }
+        var idx = 0;
+        while (depth-- > 0 && idx != -1) {
+            idx = path.indexOf("/", idx + 1);
+        }
+        if (idx == -1) {
+            idx = path.length;
+        }
+        return path.substring(0, idx);
+    };
+    
+    var getEntry = function(doc, name, revision) {
+        var result = null;
+        if (doc && doc[name] && doc[name][revision]) {
+            result = {};
+            result[revision] = doc[name][revision];
+        }
+        return result;
+    };
+    
+    var findPreviousDocument = function(path, name, revision) {
+        var rev = new Revision(revision);
+        if (path === undefined) {
+            print("No path specified");
+            return;
+        }
+        if (path.length > 165) {
+            print("Path too long");
+            return;
+        }
+        var doc = api.findOne(path);
+        if (!doc) {
+            return null;
+        }
+        var result = null;
+        forEachPrev(doc, function traverse(d, high, low, height) {
+            var highRev = new Revision(high);
+            var lowRev = new Revision(low);
+            if (highRev.getClusterId() != rev.getClusterId() 
+                    || lowRev.isNewerThan(rev) 
+                    || rev.isNewerThan(highRev)) {
+                return;
+            }
+            
+            var id = prevDocIdFor(path, high, height);
+
+            var prev = db.nodes.findOne({_id: id });
+            if (prev) {
+                if (prev[name] && prev[name][revision]) {
+                    result = prev;
+                } else {
+                    forEachPrev(prev, traverse);
+                }
+            }
+        });
+        return result;
+    };
+
+    var checkOrFixHistory = function(path, fix, verbose, ignorePathLen) {
+        if (path === undefined) {
+            print("No path specified");
+            return;
+        }
+        if (!ignorePathLen && (path.length > 165)) {
+            print("Path too long");
+            return;
+        }
+
+        var doc = api.findOne(path);
+        if (!doc) {
+            return null;
+        }
+
+        var result = {};
+        result._id = pathDepth(path) + ":" + path;
+        if (verbose) {
+            result.prevDocs = [];
+            if (fix) {
+                result.prevLinksRemoved = [];
+            } else {
+                result.prevLinksDangling = [];
+            }
+        }
+        result.numPrevDocs = 0;
+        if (fix) {
+            result.numPrevLinksRemoved = 0;
+        } else {
+            result.numPrevLinksDangling = 0;
+        }
+
+
+        forEachPrev(doc, function traverse(d, high, low, height) {
+            var id = prevDocIdFor(path, high, height);
+            var prev = db.nodes.findOne({_id: id });
+            if (prev) {
+                if (result.prevDocs) {
+                    result.prevDocs.push(high + "/" + height);
+                }
+                result.numPrevDocs++;
+                if (parseInt(height) > 0) {
+                    forEachPrev(prev, traverse);
+                }
+            } else if (fix) {
+                if (result.prevLinksRemoved) {
+                    result.prevLinksRemoved.push(high + "/" + height);
+                }
+                result.numPrevLinksRemoved++;
+                var update = {};
+                update.$inc = {_modCount : NumberLong(1)};
+                if (d._sdType == 40) { // intermediate split doc type
+                    update.$unset = {};
+                    update.$unset["_prev." + high] = 1;
+                } else {
+                    update.$set = {};
+                    update.$set["_stalePrev." + high] = height;
+                }
+                db.nodes.update({_id: d._id}, update);
+            } else {
+                if (result.prevLinksDangling) {
+                    result.prevLinksDangling.push(high + "/" + height);
+                }
+                result.numPrevLinksDangling++;
+            }
+        });
+        return result;
+    };
+
+    var forEachPrev = function(doc, callable) {
+        var stalePrev = doc._stalePrev;
+        if (!stalePrev) {
+            stalePrev = {};
+        }
+        var r;
+        for (r in doc._prev) {
+            var value = doc._prev[r];
+            var idx = value.lastIndexOf("/");
+            var height = value.substring(idx + 1);
+            var low = value.substring(0, idx);
+            if (stalePrev[r] == height) {
+                continue;
+            }
+            callable.call(this, doc, r, low, height);
+        }
+    };
+
+    var checkOrFixLastRevs = function(path, clusterId, dryRun) {
+         if (path === undefined) {
+            print("Need at least a path from where to start check/fix.");
+            return;
+         }
+         var result = [];
+         var lastRev;
+         if (path.length == 0 || path.charAt(0) != '/') {
+            return "Not a valid absolute path";
+         }
+         if (clusterId === undefined) {
+            clusterId = 1;
+         }
+         while (true) {
+            var doc = db.nodes.findOne({_id: pathDepth(path) + ":" + path});
+            if (doc) {
+                var revStr = doc._lastRev["r0-0-" + clusterId];
+                if (revStr) {
+                    var rev = new Revision(revStr);
+                    if (lastRev && lastRev.isNewerThan(rev)) {
+                        if (dryRun) {
+                            result.push({_id: doc._id, _lastRev: rev.toString(), needsFix: lastRev.toString()});
+                        } else {
+                            var update = {$set:{}};
+                            update.$set["_lastRev.r0-0-" + clusterId] = lastRev.toString();
+                            db.nodes.update({_id: doc._id}, update);
+                            result.push({_id: doc._id, _lastRev: rev.toString(), fixed: lastRev.toString()});
+                        }
+                    } else {
+                        result.push({_id: doc._id, _lastRev: rev.toString()});
+                        lastRev = rev;
+                    }
+                }
+            }
+            if (path == "/") {
+                break;
+            }
+            var idx = path.lastIndexOf("/");
+            if (idx == 0) {
+                path = "/";
+            } else {
+                path = path.substring(0, idx);
+            }
+         }
+         return result;
+    };
+
+    var Revision = function(rev) {
+        var dashIdx = rev.indexOf("-");
+        this.rev = rev;
+        this.timestamp = parseInt(rev.substring(1, dashIdx), 16);
+        this.counter = parseInt(rev.substring(dashIdx + 1, rev.indexOf("-", dashIdx + 1)), 16);
+        this.clusterId = parseInt(rev.substring(rev.lastIndexOf("-") + 1), 16);
+    };
+
+    Revision.prototype.toString = function () {
+        return this.rev;
+    };
+
+    Revision.prototype.isNewerThan = function(other) {
+        if (this.timestamp > other.timestamp) {
+            return true;
+        } else if (this.timestamp &lt; other.timestamp) {
+            return false;
+        } else {
+            return this.counter > other.counter;
+        }
+    };
+
+    Revision.prototype.toReadableString = function () {
+        return this.rev + " (" + this.asDate().toString() + ")"
+    };
+
+    Revision.prototype.asDate = function() {
+        return new Date(this.timestamp);
+    };
+
+    Revision.prototype.getClusterId = function() {
+        return this.clusterId;
+    };
+
+    var pathDepth = function(path){
+        if(path === '/'){
+            return 0;
+        }
+        var depth = 0;
+        for(var i = 0; i &lt; path.length; i++){
+            if(path.charAt(i) === '/'){
+                depth++;
+            }
+        }
+        return depth;
+    };
+    
+    var prevDocIdFor = function(path, high, height) {
+        var p = "p" + path;
+        if (p.charAt(p.length - 1) != "/") {
+            p += "/";
+        }
+        p += high + "/" + height;
+        return (pathDepth(path) + 2) + ":" + p;
+    };
+
+    var pathFilter = function (depth, prefix){
+        return new RegExp("^"+ depth + ":" + escapeForRegExp(prefix));
+    };
+
+    var longPathFilter = function (depth, prefix) {
+        var filter = {};
+        filter._id = new RegExp("^" + depth + ":h");
+        filter._path = new RegExp("^" + escapeForRegExp(prefix));
+        return filter;
+    };
+
+    var longPathQuery = function (path) {
+        var query = {};
+        query._id = new RegExp("^" + pathDepth(path) + ":h");
+        query._path = path;
+        return query;
+    };
+
+    //http://stackoverflow.com/a/20732091/1035417
+    var humanFileSize = function (size) {
+        var i = Math.floor( Math.log(size) / Math.log(1024) );
+        return ( size / Math.pow(1024, i) ).toFixed(2) * 1 + ' ' + ['B', 'kB', 'MB', 'GB', 'TB'][i];
+    };
+    
+    // http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
+    var escapeForRegExp = function(s) {
+        return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+    };
+
+    return api;
+}(this));</code></pre>
+        </article>
+    </section>
+
+
+
+
+</div>
+
+<nav>
+    <h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="oak.html">oak</a></li></ul>
+</nav>
+
+<br clear="both">
+
+<footer>
+    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.3-dev</a> on Thu Mar 12 2015 12:09:19 GMT+0100 (CET)
+</footer>
+
+<script> prettyPrint(); </script>
+<script src="scripts/linenumber.js"> </script>
+</body>
+</html>
\ No newline at end of file

Propchange: jackrabbit/site/live/oak/docs/oak-mongo-js/oak-mongo.js.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/site/live/oak/docs/oak-mongo-js/oak.html
URL: http://svn.apache.org/viewvc/jackrabbit/site/live/oak/docs/oak-mongo-js/oak.html?rev=1666141&view=auto
==============================================================================
--- jackrabbit/site/live/oak/docs/oak-mongo-js/oak.html (added)
+++ jackrabbit/site/live/oak/docs/oak-mongo-js/oak.html Thu Mar 12 11:14:50 2015
@@ -0,0 +1,3436 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <title>JSDoc: Namespace: oak</title>
+    
+    <script src="scripts/prettify/prettify.js"> </script>
+    <script src="scripts/prettify/lang-css.js"> </script>
+    <!--[if lt IE 9]>
+      <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
+    <![endif]-->
+    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
+    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
+</head>
+
+<body>
+
+<div id="main">
+    
+    <h1 class="page-title">Namespace: oak</h1>
+    
+    
+
+
+
+<section>
+    
+<header>
+    <h2>
+    oak
+    </h2>
+    
+</header>  
+
+<article>
+    <div class="container-overview">
+    
+    
+    
+        
+        
+        
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line22">line 22</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+        
+        
+    
+    </div>
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+        <h3 class="subsection-title">Methods</h3>
+        
+        <dl>
+            
+<dt>
+    <h4 class="name" id="blobStats"><span class="type-signature">&lt;static> </span>blobStats<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Returns statistics about the blobs collection in the current database.
+The stats include the combined BSON size of all documents. The time to
+run this command therefore heavily depends on the size of the collection.
+    </div>
+    
+
+    
+    
+    
+    
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line184">line 184</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    statistics about the blobs collection.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">object</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="checkDeepHistory"><span class="type-signature">&lt;static> </span>checkDeepHistory<span class="signature">(path, <span class="optional">verbose</span>)</span><span class="type-signature"></span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Same as checkHistory except it goes through ALL descendants as well!
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		<th>Argument</th>
+		
+		
+		
+		<th>Default</th>
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+                <td class="attributes">
+                
+                    
+                
+                    
+                
+                </td>
+            
+            
+            
+                <td class="default">
+                
+                </td>
+            
+            
+            <td class="description last">the path of the document.</td>
+        </tr>
+	
+	
+	
+        <tr>
+            
+                <td class="name"><code>verbose</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">boolean</span>
+
+
+            
+            </td>
+            
+            
+                <td class="attributes">
+                
+                    &lt;optional><br>
+                
+                    
+                
+                    
+                
+                </td>
+            
+            
+            
+                <td class="default">
+                
+                    false
+                
+                </td>
+            
+            
+            <td class="description last">if true, the result object will contain a list
+       of dangling references to previous documents.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line453">line 453</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="checkHistory"><span class="type-signature">&lt;static> </span>checkHistory<span class="signature">(path, <span class="optional">verbose</span>, <span class="optional">ignorePathLen</span>)</span><span class="type-signature"> &rarr; {object}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Checks the history of previous documents at the given path. Orphaned
+references to removed previous documents are counted and listed when
+run with verbose set to true.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		<th>Argument</th>
+		
+		
+		
+		<th>Default</th>
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+                <td class="attributes">
+                
+                    
+                
+                    
+                
+                </td>
+            
+            
+            
+                <td class="default">
+                
+                </td>
+            
+            
+            <td class="description last">the path of the document.</td>
+        </tr>
+	
+	
+	
+        <tr>
+            
+                <td class="name"><code>verbose</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">boolean</span>
+
+
+            
+            </td>
+            
+            
+                <td class="attributes">
+                
+                    &lt;optional><br>
+                
+                    
+                
+                    
+                
+                </td>
+            
+            
+            
+                <td class="default">
+                
+                    false
+                
+                </td>
+            
+            
+            <td class="description last">if true, the result object will contain a list
+       of dangling references to previous documents.</td>
+        </tr>
+	
+	
+	
+        <tr>
+            
+                <td class="name"><code>ignorePathLen</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">boolean</span>
+
+
+            
+            </td>
+            
+            
+                <td class="attributes">
+                
+                    &lt;optional><br>
+                
+                    
+                
+                    
+                
+                </td>
+            
+            
+            
+                <td class="default">
+                
+                    false
+                
+                </td>
+            
+            
+            <td class="description last">whether to ignore a long path and
+       still try to read it from MongoDB.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line389">line 389</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    the result of the check.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">object</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="checkLastRevs"><span class="type-signature">&lt;static> </span>checkLastRevs<span class="signature">(path, clusterId)</span><span class="type-signature"> &rarr; {object}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Checks the _lastRev for a given clusterId. The checks starts with the
+given path and walks up to the root node.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the path of a node to check</td>
+        </tr>
+	
+	
+	
+        <tr>
+            
+                <td class="name"><code>clusterId</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">number</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the id of an oak cluster node.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line156">line 156</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    the result of the check.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">object</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="countChildren"><span class="type-signature">&lt;static> </span>countChildren<span class="signature">(path)</span><span class="type-signature"> &rarr; {number}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Determines the number of child node (including all sub tree)
+for a given parent node path. This would be faster compared to
+getChildStats as it does not load the doc and works on
+index only.
+
+Note that there might be some difference between db.nodes.count()
+and countChildren('/') as split docs, intermediate docs are not
+accounted for
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the path of a node.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line73">line 73</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    the number of children, including all descendant nodes.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">number</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="findOne"><span class="type-signature">&lt;static> </span>findOne<span class="signature">(path)</span><span class="type-signature"> &rarr; {object}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Finds the document with the given path.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the path of the document.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line374">line 374</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    the document or null if it doesn't exist.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">object</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="fixDeepHistory"><span class="type-signature">&lt;static> </span>fixDeepHistory<span class="signature">(path, <span class="optional">verbose</span>)</span><span class="type-signature"></span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Same as fixHistory except it goes through ALL descendants as well!
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		<th>Argument</th>
+		
+		
+		
+		<th>Default</th>
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+                <td class="attributes">
+                
+                    
+                
+                    
+                
+                </td>
+            
+            
+            
+                <td class="default">
+                
+                </td>
+            
+            
+            <td class="description last">the path of the document.</td>
+        </tr>
+	
+	
+	
+        <tr>
+            
+                <td class="name"><code>verbose</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">boolean</span>
+
+
+            
+            </td>
+            
+            
+                <td class="attributes">
+                
+                    &lt;optional><br>
+                
+                    
+                
+                    
+                
+                </td>
+            
+            
+            
+                <td class="default">
+                
+                    false
+                
+                </td>
+            
+            
+            <td class="description last">if true, the result object will contain a list
+       of removed references to previous documents.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line486">line 486</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="fixHistory"><span class="type-signature">&lt;static> </span>fixHistory<span class="signature">(path, <span class="optional">verbose</span>)</span><span class="type-signature"> &rarr; {object}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Repairs the history of previous documents at the given path. Orphaned
+references to removed previous documents are cleaned up and listed when
+run with verbose set to true.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		<th>Argument</th>
+		
+		
+		
+		<th>Default</th>
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+                <td class="attributes">
+                
+                    
+                
+                    
+                
+                </td>
+            
+            
+            
+                <td class="default">
+                
+                </td>
+            
+            
+            <td class="description last">the path of the document.</td>
+        </tr>
+	
+	
+	
+        <tr>
+            
+                <td class="name"><code>verbose</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">boolean</span>
+
+
+            
+            </td>
+            
+            
+                <td class="attributes">
+                
+                    &lt;optional><br>
+                
+                    
+                
+                    
+                
+                </td>
+            
+            
+            
+                <td class="default">
+                
+                    false
+                
+                </td>
+            
+            
+            <td class="description last">if true, the result object will contain a list
+       of removed references to previous documents.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line499">line 499</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    the result of the fix.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">object</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="fixLastRevs"><span class="type-signature">&lt;static> </span>fixLastRevs<span class="signature">(path, clusterId)</span><span class="type-signature"> &rarr; {object}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Fixes the _lastRev for a given clusterId. The fix starts with the
+given path and walks up to the root node.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the path of a node to fix</td>
+        </tr>
+	
+	
+	
+        <tr>
+            
+                <td class="name"><code>clusterId</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">number</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the id of an oak cluster node.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line170">line 170</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    the result of the fix.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">object</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="forEachChild"><span class="type-signature">&lt;static> </span>forEachChild<span class="signature">(path, callable)</span><span class="type-signature"></span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Performs a breadth first traversal for nodes under given path
+and invokes the passed function for each child node.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the path of a node.</td>
+        </tr>
+	
+	
+	
+        <tr>
+            
+                <td class="name"><code>callable</code></td>
+            
+            
+            <td class="type">
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">a function to be called for each child node including all
+       descendant nodes. The MongoDB document is passed as the single
+       parameter of the function.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line121">line 121</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="formatRevision"><span class="type-signature">&lt;static> </span>formatRevision<span class="signature">(rev)</span><span class="type-signature"> &rarr; {string}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Converts the given Revision String into a more human readable version,
+which also prints the date.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>rev</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">a revision string.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line206">line 206</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    a human readable string representation of the revision.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">string</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="getChildStats"><span class="type-signature">&lt;static> </span>getChildStats<span class="signature">(path)</span><span class="type-signature"> &rarr; {Object}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Provides stats related to number of child nodes
+below given path or total size taken by such nodes.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the path of a node.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line101">line 101</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    statistics about the child nodes
+         including all descendants.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">Object</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="getCommitValue"><span class="type-signature">&lt;static> </span>getCommitValue<span class="signature">(path, revision)</span><span class="type-signature"> &rarr; {object}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Returns the commit value entry for the change with the given revision.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the path of a document.</td>
+        </tr>
+	
+	
+	
+        <tr>
+            
+                <td class="name"><code>revision</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the revision of a change on the document.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line515">line 515</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    the commit entry for the given revision or null if
+         there is none.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">object</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="indexStats"><span class="type-signature">&lt;static> </span>indexStats<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Collects various stats related to Oak indexes stored under /oak:index.
+    </div>
+    
+
+    
+    
+    
+    
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line49">line 49</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    index stats.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">Array</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="listCheckpoints"><span class="type-signature">&lt;static> </span>listCheckpoints<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        List all checkpoints.
+    </div>
+    
+
+    
+    
+    
+    
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line259">line 259</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    all checkpoints
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">object</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="listChildren"><span class="type-signature">&lt;static> </span>listChildren<span class="signature">(path)</span><span class="type-signature"></span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Lists the children at a given path.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">list the children of the document with this path.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line427">line 427</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="listDescendants"><span class="type-signature">&lt;static> </span>listDescendants<span class="signature">(path)</span><span class="type-signature"></span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Lists the descendant documents at a given path.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">list the descendants of the document with this path.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line407">line 407</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="pathFromId"><span class="type-signature">&lt;static> </span>pathFromId<span class="signature">(id)</span><span class="type-signature"> &rarr; {string}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Returns the path part of the given id.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>id</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the id of a Document in the nodes collection.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line143">line 143</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    the path derived from the id.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">string</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="prepareDeepHistory"><span class="type-signature">&lt;static> </span>prepareDeepHistory<span class="signature">(path, <span class="optional">verbose</span>)</span><span class="type-signature"></span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Preparation step which scans through all descendants and prints out
+'fixHistory' for those that need fixing of their 'dangling references'.
+<p>
+See fixHistory for parameter details.
+<p>
+Run this command via something as follows:
+<p>
+ mongo &lt;DBNAME> -eval "load('oak-mongo.js'); oak.prepareDeepHistory('/');" > fix.js
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		<th>Argument</th>
+		
+		
+		
+		<th>Default</th>
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+                <td class="attributes">
+                
+                    
+                
+                    
+                
+                </td>
+            
+            
+            
+                <td class="default">
+                
+                </td>
+            
+            
+            <td class="description last">the path of a document.</td>
+        </tr>
+	
+	
+	
+        <tr>
+            
+                <td class="name"><code>verbose</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">boolean</span>
+
+
+            
+            </td>
+            
+            
+                <td class="attributes">
+                
+                    &lt;optional><br>
+                
+                    
+                
+                    
+                
+                </td>
+            
+            
+            
+                <td class="default">
+                
+                    false
+                
+                </td>
+            
+            
+            <td class="description last">if true, the result object will contain a list
+       of dangling references to previous documents.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line466">line 466</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="removeCheckpointsOlderThan"><span class="type-signature">&lt;static> </span>removeCheckpointsOlderThan<span class="signature">(rev)</span><span class="type-signature"> &rarr; {object}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Removes all checkpoints older than a given Revision.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>rev</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">checkpoints older than this revision are removed.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line288">line 288</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    the result of the MongoDB update.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">object</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="removeCollisions"><span class="type-signature">&lt;static> </span>removeCollisions<span class="signature">(path, clusterId)</span><span class="type-signature"> &rarr; {object}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Removes all collision markers on the document with the given path and
+clusterId. This method will only remove collisions when the clusterId
+is inactive.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the path of a document</td>
+        </tr>
+	
+	
+	
+        <tr>
+            
+                <td class="name"><code>clusterId</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">number</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">collision markers for this clusterId will be removed.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line322">line 322</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    the result of the MongoDB update.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">object</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="removeDescendantsAndSelf"><span class="type-signature">&lt;static> </span>removeDescendantsAndSelf<span class="signature">(path)</span><span class="type-signature"></span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Removes the complete subtree rooted at the given path.
+    </div>
+    
+
+    
+    
+    
+    
+    
+        <h5>Parameters:</h5>
+        
+
+<table class="params">
+    <thead>
+	<tr>
+		
+		<th>Name</th>
+		
+		
+		<th>Type</th>
+		
+		
+		
+		
+		
+		<th class="last">Description</th>
+	</tr>
+	</thead>
+	
+	<tbody>
+	
+	
+        <tr>
+            
+                <td class="name"><code>path</code></td>
+            
+            
+            <td class="type">
+            
+                
+<span class="param-type">string</span>
+
+
+            
+            </td>
+            
+            
+            
+            
+            
+            <td class="description last">the path of the subtree to remove.</td>
+        </tr>
+	
+	
+	</tbody>
+</table>
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line219">line 219</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    
+    
+</dd>
+
+        
+            
+<dt>
+    <h4 class="name" id="systemStats"><span class="type-signature">&lt;static> </span>systemStats<span class="signature">()</span><span class="type-signature"> &rarr; {object}</span></h4>
+    
+    
+</dt>
+<dd>
+    
+    
+    <div class="description">
+        Collects various stats related to Oak usage of Mongo.
+    </div>
+    
+
+    
+    
+    
+    
+    
+    
+    
+<dl class="details">
+    
+        
+    
+    
+    
+
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    <dt class="tag-source">Source:</dt>
+    <dd class="tag-source"><ul class="dummy"><li>
+        <a href="oak-mongo.js.html">oak-mongo.js</a>, <a href="oak-mongo.js.html#line31">line 31</a>
+    </li></ul></dd>
+    
+    
+    
+    
+    
+    
+    
+</dl>
+
+    
+    
+
+    
+
+    
+    
+    
+    
+    
+    <h5>Returns:</h5>
+    
+            
+<div class="param-desc">
+    system stats.
+</div>
+
+
+
+<dl>
+	<dt>
+		Type
+	</dt>
+	<dd>
+		
+<span class="param-type">object</span>
+
+
+	</dd>
+</dl>
+
+        
+    
+    
+</dd>
+
+        </dl>
+    
+    
+    
+    
+    
+</article>
+
+</section>  
+
+
+
+
+</div>
+
+<nav>
+    <h2><a href="index.html">Index</a></h2><h3>Namespaces</h3><ul><li><a href="oak.html">oak</a></li></ul>
+</nav>
+
+<br clear="both">
+
+<footer>
+    Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.3-dev</a> on Thu Mar 12 2015 12:09:19 GMT+0100 (CET)
+</footer>
+
+<script> prettyPrint(); </script>
+<script src="scripts/linenumber.js"> </script>
+</body>
+</html>
\ No newline at end of file

Propchange: jackrabbit/site/live/oak/docs/oak-mongo-js/oak.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: jackrabbit/site/live/oak/docs/oak-mongo-js/scripts/linenumber.js
URL: http://svn.apache.org/viewvc/jackrabbit/site/live/oak/docs/oak-mongo-js/scripts/linenumber.js?rev=1666141&view=auto
==============================================================================
--- jackrabbit/site/live/oak/docs/oak-mongo-js/scripts/linenumber.js (added)
+++ jackrabbit/site/live/oak/docs/oak-mongo-js/scripts/linenumber.js Thu Mar 12 11:14:50 2015
@@ -0,0 +1,17 @@
+(function() {
+    var counter = 0;
+    var numbered;
+    var source = document.getElementsByClassName('prettyprint source');
+
+    if (source && source[0]) {
+        source = source[0].getElementsByTagName('code')[0];
+
+        numbered = source.innerHTML.split('\n');
+        numbered = numbered.map(function(item) {
+            counter++;
+            return '<span id="line' + counter + '" class="line"></span>' + item;
+        });
+
+        source.innerHTML = numbered.join('\n');
+    }
+})();
\ No newline at end of file

Propchange: jackrabbit/site/live/oak/docs/oak-mongo-js/scripts/linenumber.js
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message