Last active
November 2, 2015 07:03
-
-
Save twinsdbv/88b1304767521416927d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 3.2 | |
posts.insert(post, function (err, result) { | |
"use strict"; | |
if (!err) { | |
console.log("Inserted new post"); | |
return callback(null, permalink); | |
} | |
return callback(err, null); | |
}); | |
// 3.3 | |
var post = this.getPostByPermalink(permalink, function (err, post) { | |
if (err) return callback(err, null); | |
posts.update({_id: post._id}, {$addToSet: {'comments': comment}}, function (err, result) { | |
"use strict"; | |
if (!err) { | |
console.log("Inserted new comment"); | |
return callback(null, result[0]); | |
} else { | |
return callback(err, null); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment