var mongoose = require('mongoose');
var config = require('../config').config;
mongoose.connect(config.db, function (err) {
  if (err) {
    console.error('connect to %s error: ', config.db, err.message);
    process.exit(1);
  }
});

// models
require('./user');
require('./article');

exports.User = mongoose.model('User');
exports.Article = mongoose.model('Article');
@@ -70,16 +70,68 @@
 .config;
+%0A%0A// models%0Arequire('./user');%0Arequire('./article');
 %0Amongoos
@@ -168,18 +168,16 @@
 (err) %7B%0A
-  
 if (err)
@@ -179,16 +179,57 @@
 (err) %7B%0A
+        mongoose.connection.close();%0A    
     cons
@@ -288,16 +288,20 @@
 ssage);%0A
+    
     proc
@@ -317,16 +317,18 @@
 1);%0A
+  
   %7D%0A%7D);%0A
 %0A// 
@@ -327,61 +327,8 @@
 %7D);%0A
-%0A// models%0Arequire('./user');%0Arequire('./article');%0A%0A
 expo

update db