Permalink
Browse files

Update comments

- no more comment.regular
- no more hashes of the complete comment
- ensure indexes in a single operation
  • Loading branch information...
1 parent 336ca95 commit cc5477bd61fd9aafe2943455b0175ba55f35399c @pvorb committed Mar 6, 2012
Showing with 4 additions and 13 deletions.
  1. +4 −13 comments.js
View
@@ -53,14 +53,10 @@ Comments.prototype.connect = function connect(connected) {
self.comments = col;
- async.parallel([
- function (ensured) {
- col.ensureIndex('res', ensured);
- },
- function (ensured) {
- col.ensureIndex('modified', ensured);
- }
- ], function (err) {
+ col.ensureIndex({
+ res: -1,
+ modified: -1
+ }, function (err) {
if (err)
return cb(err);
@@ -112,9 +108,6 @@ Comments.prototype.saveComment = function saveComment(res, comment, saved) {
// modified
comment.modified = new Date();
- // hash the comment, necessary for future comment editing
- comment.hash = sha1(JSON.stringify(comment));
-
// get collection and save comment
this.getCollections(function(err, col) {
if (err)
@@ -278,8 +271,6 @@ Comments.prototype.setCommentJSON = function setCommentJSON(res, comment,
return saved(new Error('Precondition failed.'));
}
- comment.regular = true;
-
// save comment
this.saveComment(res, comment, function(err, comment) {
if (err) {

0 comments on commit cc5477b

Please sign in to comment.