mongoose post函数错误(undefined不是函数)

时间:2015-07-12 07:03:32

标签: javascript node.js mongodb

这是post函数,update更新了日期值,同样的错误

function postParty(req, res) {
var Party = new Party();

Party.title = req.body.title;
Party.username = req.body.username;
Party.location = req.body.location;
Party.time = req.body.time;
Party.about = req.body.about;
Party.invites=req.body.invites;
Party.isPrivate = req.body.isPrivate;
//Party.date=Date.now();

Party.save(function (err,party) {
 if (err)
  res.send(err);
  res.json({ message: 'party created!' });
 });
}

这是我的架构

var PartyScheme = new Schema({
title: String,
username: String,
location: String,
time: String,
//date: { type: Date, default: Date.now },
about: String,
invites: [{username: String , user_id: Number }],
isPrivate: Boolean,
 });

var Party = mongoose.model('Party', PartyScheme);

url - / partys,postParty,
和邮件请求上的此错误
{   "代码":" InternalError",   " message":" undefined不是一个函数" }

0 个答案:

没有答案