lots of work so far-- mostly tidying

This commit is contained in:
2013-01-05 15:07:07 -05:00
parent 3726488bcc
commit 29873db3cf
968 changed files with 307391 additions and 0 deletions

31
node_modules/mongoskin/examples/generateId.js generated vendored Normal file
View File

@@ -0,0 +1,31 @@
var redis = require('redis').createClient()
, shorten = require('shorten')(redis)
, async = require('async')
, db = require('./config').db
;
db.bind('user');
function log(err) {
if(err) {
console.log(err.stack);
}
}
function createUser(user, callback) {
async.waterfall([
function(fn) {
shorten.nextId('user', fn);
}
, function(uid, fn) {
user.uid = uid;
db.user.save(user, fn);
}
], callback);
}
for(var i = 0; i<10; i++) {
createUser({name: 'user' + i}, log);
}