亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

schemas中問題:

schemas中問題:

Elly 2016-05-11 09:25:45
問題:MovieSchema.pre('save',function(next){^^^^^^^^^^^SyntaxError: Unexpected identifier源代碼:var mongoose = require('mongoose')//骨架模版var MovieSchema = new mongoose.Schema({?? ?doctor:String,?? ?title:String,?? ?language:String,?? ?country:String,?? ?year:Number,?? ?summary:String,?? ?flash:String,?? ?poster:String,?? ?meta:{?? ??? ?createAt:{?? ??? ??? ?type:Date,?? ??? ??? ?default:Date.now()?? ??? ?},?? ??? ?updateAt:{?? ??? ??? ?type:Date,?? ??? ??? ?default:Date.now()?? ??? ?}?? ?}//為模式增加方法MovieSchema.pre('save',function(next){?? ?if (this.isNew) {?? ??? ?this.meta.createAt = this.meta.updateAt = Date.now()?? ?}else{?? ??? ?this.meta.updateAt = Date.now()?? ?}})//添加靜態方法MovieSchema.statics ={?? ?fetch:function(cb){?? ??? ?return this?? ??? ??? .find({})?? ??? ??? .sort('meta.updateAt')?? ??? ??? .exec(cb)?? ?},?? ?findById:function(id,cb){?? ??? ?return this?? ??? ??????? .findOne({_id:id})?? ??? ??????? .exec(cb)?? ?}}module.exports = MovieSchema
查看完整描述

1 回答

?
一頭飛奔的豬

TA貢獻9條經驗 獲得超17個贊

//為模式增加方法 ? 上面少個});

查看完整回答
1 反對 回復 2016-05-11
  • 1 回答
  • 0 關注
  • 1491 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號