NodeJS + Express + Mongoose(MongoDB)数据库插入错误

|| 我在使用NodeJS / Express / Mongoose执行以下代码时,在mongodb日志中收到错误\“ Sun Jun 12 15:27:12 SyntaxError:missing; before statement(shell):1 \”)。我没有从函数返回错误。任何指导将不胜感激。
// Launch express and server
var express = require(\'express\');
var app = express.createServer();

//connect to DB
var mongoose = require(\'mongoose\');
var db = mongoose.connect(\'mongodb://127.0.0.1/napkin_0.1\');

// Define Model
var Schema = mongoose.Schema;

var UserSchema = new Schema({
    name : String,
    age : String
});

mongoose.model(\'Document\', UserSchema);
var User = mongoose.model(\'Document\');

var user = new User();

user.name = \'Jim\';
user.age = \'27\';
user.save(function(err, user_Saved){
    if(err){
        throw err;
        console.log(err);
    }else{
        console.log(\'saved!\');
    }
});

//Launch Server
app.listen(3002);
    
已邀请:
        数据库名称不应包含\'。\'。只需删除。它将正常工作。     
        @matty我们不应该删除\“ throw err; \” 因为如果我们在那里将错误错误回调2     

要回复问题请先登录注册