From b1315c97f65497143b526237b252cc524d78811a Mon Sep 17 00:00:00 2001 From: Louis Chatriot Date: Thu, 30 May 2013 13:33:10 +0200 Subject: [PATCH] More doc on the _id collision probability --- lib/customUtils.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/customUtils.js b/lib/customUtils.js index c7e0819..4283f0a 100644 --- a/lib/customUtils.js +++ b/lib/customUtils.js @@ -22,6 +22,8 @@ function ensureDirectoryExists (dir, cb) { * There is a very small probability (less than 1/1,000,000) for the length to be less than len * (il the base64 conversion yields too many pluses and slashes) but * that's not an issue here + * The probability of a collision is extremely small (need 3*10^12 documents to have one chance in a million of a collision) + * See http://en.wikipedia.org/wiki/Birthday_problem */ function uid (len) { return crypto.randomBytes(Math.ceil(Math.max(8, len * 2)))