Permalink
Browse files

Fixed minor issues

  • Loading branch information...
1 parent d780245 commit ad39688464a1d55b1f289eacd178942fbc050a56 @pvorb committed Sep 1, 2011
Showing with 8 additions and 5 deletions.
  1. +5 −4 lib/Index.add.js
  2. +3 −1 lib/Index.js
View
@@ -14,10 +14,11 @@ Index.prototype.add = function(data) {
// Go through indexes and create a connection for each
else {
- // add new tags
- for (var i = 0; i < data.tags.length; i++) {
- this.tags[data.tags[i]] = true;
- }
+ if (data.tags)
+ // add new tags
+ for (var i = 0; i < data.tags.length; i++) {
+ this.tags[data.tags[i]] = true;
+ }
// save data
this.collection.save(data);
View
@@ -3,6 +3,8 @@ var mongodb = require("mongodb");
var MongoDB = mongodb.Db,
MongoServer = mongodb.Server;
+var todo;
+
// Init the database connection
function Index(opt, callback) {
@@ -12,7 +14,7 @@ function Index(opt, callback) {
instance.opt = opt;
instance.tags = {};
- var todo = 2;
+ todo = 2;
// Init db connection
var server = new MongoServer(opt.host, opt.port);

0 comments on commit ad39688

Please sign in to comment.