Skip to content

Instantly share code, notes, and snippets.

Created Dec 12, 2012

What would you like to do?
Couch DB, relate data sets of users and uploaded documents. Currently times out.
var cradle = require('cradle');
var usersdb = new(cradle.Connection)().database('users');
var documentsdb = new(cradle.Connection)().database('documents');
* GET users listing.
exports.user = getUser;
function getUser (req, res){
usersdb.get(req.params.username, function (err, doc) {
for (var i = 0;i <= doc.documents.length;i++){
//cycle the documents through getDocument
doc.documents[i] = getDocument(doc.documents[i]);
// render the paths and names of the documents (currently undefined)
res.render('user', doc);
function getDocument (documentID) {
var response = true;
documentsdb.get(documentID, function (err, doc) {
//get the path and name of each document from documents db
response = doc;
while (response){}
return response;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.