For the curious, the equivalent example from the OP using promises[1]:
function getUserFriends(userName) {
return db.users.findOne({ name: userName }).then(function (user) {
return db.friends.find({ userId: user.id });
});
}
[1]: http://promises-aplus.github.io/promises-spec/