插入ISO数据后,mongoDB中的数据无效 [英] Invalid data in mongoDB after insert of an ISO data
本文介绍了插入ISO数据后,mongoDB中的数据无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试将基于dayClick事件的记录存储在jquery fullcalendar之外。根据控制台日志提供的日期为:
locale:Object,_d:Date 2015-03-19T00:00:00.000Z,然后我将它传递给ce.start和ce .end,当我检查数据库时,我有'无效日期'作为在calevnt.start和calevent.end中的值---这里有什么错?
I try to store a record based on a dayClick event out of the jquery fullcalendar. According to the consol log the date is provided as: locale: Object, _d: Date 2015-03-19T00:00:00.000Z, then I pass it to ce.start and ce.end, when I check the database I have 'Invalid date' as value in calevnt.start and calevent.end --- What's wrong here?
在客户端:
On the client:
Template.calendar.helpers({
options: function() {
return {
lang: 'de',
dayClick:function(date,allDay,jsEvent,view){
var ce = {};
ce.start = date;
ce.end = date;
ce.color = 'red';
ce.className = 'todo';
ce.project = Session.get('active_project');
ce.title = ' Jour Fixe2';
ce.owner = Meteor.userId;
console.log(date,allDay,jsEvent,view);
Meteor.call('addCalEvent',ce);
}
}
}
});
在服务器上:
On the server:
'addCalEvent': function (calevent) {
if (!calevent.type) {
calevent.type = 'milestone';
}
return Calevents.insert(calevent);
},
推荐答案
$ {
try
Template.calendar.helpers({
options: function() {
return {
selectable: true,
selectHelper: true,
lang: 'de',
select: function(start, end, allDay) {
var ce = {};
ce.start = start.format(); // return moment date
ce.end = end.format(); // return moment date
ce.color = 'red';
ce.className = 'todo';
ce.project = Session.get('active_project');
ce.title = ' Jour Fixe2';
ce.owner = Meteor.userId;
console.log(start, end);
Meteor.call('addCalEvent',ce);
}
}
}
});
这篇关于插入ISO数据后,mongoDB中的数据无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文