Skip to content

Instantly share code, notes, and snippets.

@ppillip
Last active August 29, 2015 14:16
Show Gist options
  • Save ppillip/6195db6c761db529947b to your computer and use it in GitHub Desktop.
Save ppillip/6195db6c761db529947b to your computer and use it in GitHub Desktop.
첫번째
C01 = new Mongo.Collection('CYSNET_a_1');
TestResult =new Mongo.Collection('testResult');
//배치
var batch = [
{
name : 'min1',
term : later.parse.text('every 1 second'),
doSomething : function(){
console.log('나는 1111');
},
handle : null
}
,{
name : 'min2',
term : later.parse.text('every 5 second'),
doSomething : function(){
console.log('나는 5555');
},
handle : null
}
];
_.each(batch , function(obj,idx){
obj.handle = new ScheduledTask(obj.term,obj.doSomething);
});
Meteor.methods({
startTaskThatAll : function(){
_.each(batch , function(obj,idx){
obj.handle.start();
});
}
,startTaskThatOne : function(){
_.findWhere(batch,{name:key}).handle.start();
}
,stopTaskThatOne : function(key){
_.findWhere(batch,{name:key}).handle.stop();
}
,nice : function(param){
var condition = {};
if(!param){
condition = [
{
$match : {
C_CONTENT1_ARRAY:{$exists:true}
,$and : [
{ CSDATE : { $gt : '20020225'} }
,{ CSDATE : { $lt : '20040410'} }
]
}
},
{
$unwind : '$C_CONTENT1_ARRAY'
},
{
$project : {
count : "$C_CONTENT1_ARRAY.c"
,word : "$C_CONTENT1_ARRAY.w"
}
},
{
$group : {
_id : '$word'
,count : { $sum : '$count'}
}
},
{
$match : {
_id : {$in : ['현재','주동','학습']}
}
}
];
}else{
condition = param;
}
console.log('시작');
var xxx = C01.aggregate(condition);
TestResult.insert(xxx);
console.log('끝');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment