summaryrefslogtreecommitdiff
path: root/week-7/Final4/blog/posts.js
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-02-21 22:10:49 -0700
committermo khan <mo@mokhan.ca>2015-02-21 22:10:49 -0700
commit865a5700c8609929574c63f3f03aec7d302be997 (patch)
tree1957761935eb32197f28648165231b528bc1d8f2 /week-7/Final4/blog/posts.js
parentfe7e28edee40691d8b1189769a9b1b9939686d77 (diff)
parent10d3fd510f9a546ebbbbb0e4166f7c639af1f05e (diff)
merge with master.main
Diffstat (limited to 'week-7/Final4/blog/posts.js')
-rw-r--r--week-7/Final4/blog/posts.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/week-7/Final4/blog/posts.js b/week-7/Final4/blog/posts.js
index 0769fcf..59f4f3b 100644
--- a/week-7/Final4/blog/posts.js
+++ b/week-7/Final4/blog/posts.js
@@ -126,7 +126,15 @@ function PostsDAO(db) {
// is zero indexed).
// TODO: Final exam question - Increment the number of likes
- callback(Error("incrementLikes NYI"), null);
+ //callback(Error("incrementLikes NYI"), null);
+ var selector = {};
+ selector['comments.' + comment_ordinal + '.num_likes'] = 1
+ posts.update({'permalink': permalink}, {'$inc': selector}, function(err, numModified) {
+ "use strict";
+ if (err) return callback(err, null);
+ callback(err, numModified);
+ });
+
}
}