Mongoose Schema - 创建方法添加意外值

时间:2017-03-08 10:13:37

标签: javascript node.js mongodb mongoose

我和Mongoose有一个奇怪的问题。我有Schema叫竞赛:

media

当我想在现有记录中编辑contest.media['shareImage'] = imageObject; contest.markModified('media'); contest.save(); 属性时,我会这样做:

Contest.create({
  author: author,
  name: 'Contest title',
  description: ''
});

在更新现有记录之后。但之后我尝试使用此代码在服务的其他地方添加新记录:

media

新的比赛记录的media属性与之前更新的记录相同。

我不知道为什么当我没有将create字段传递给方法Handler handler=new Handler(); handler.postDelayed(new Runnable() { @Override public void run() { //your code } },20000);

时,Mongoose会为AlarmManager alarmMgr = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE); // Set the alarm to start at approximately 2:00 p.m. Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(System.currentTimeMillis()); Intent intent = new Intent(HomeActivity.this, Yourservice.class); alarmIntent = PendingIntent.getService(HomeActivity.this, 0, intent, 0); alarmMgr.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), 600*1000, alarmIntent); 字段增加价值

0 个答案:

没有答案