team_id
没有设置值,但是当我查看数据时,没有team_id === null
模型
var LeaguePosition = new Schema({
team_id: { type: Schema.ObjectId, ref: 'Clubs', default: null },
leagueID: String,
position: Number,
previousPosition: Number,
gf: Number,
pld: Number,
ga: Number,
gd: Number,
pts: Number,
w: Number,
d: Number,
l: Number,
data: Date,
week: {type: Number, default: 0}
})
数据
{
"_id" : ObjectId("584c82b6d4a2102fd0fd1eb1"),
"pts" : 16,
"pld" : 10,
"l" : 4,
"d" : 1,
"w" : 5,
"gd" : 2,
"ga" : 26,
"gf" : 28,
"leagueID" : "969975213",
"previousPosition" : -1,
"position" : 1,
"week" : 1,
"__v" : 0
}
保存
var pos = new LeaguePosition();
pos.position = index;
pos.previousPosition = previousPosition;
pos.leagueID = passData.leagueInfo.currentLeagueID;
pos.gf = item.gf;
pos.ga = item.ga;
pos.gd = item.gd;
pos.w = item.w;
pos.d = item.d;
pos.l = item.l;
pos.pld = item.pld;
pos.pts = item.pts;
pos.week = passData.leagueWeek+1;
return pos.save()