Last active
October 7, 2015 02:56
-
-
Save fakenickels/82bdbc75e2017255dad5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @locus: server | |
if(Meteor.isServer){ | |
Tracker.autorun(() => { | |
CollectionObserved.find(); | |
collectAndSaveData(); | |
}); | |
function collectAndSaveData(){ | |
var aggregateData = CollectionObserved.aggregate(...); | |
var aggregateDocId = ...; | |
AggregateDataCollection.update(aggregateDocId, { | |
$set: aggregateData | |
}); | |
} | |
// Publish | |
Meteor.publish('aggregateDataCol', function(){ | |
return AggregateDataCollection.find(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment