I am using MiniMongo through Meteor, and I am trying to create a frequency table based on a dynamic set of queries.
I have two main fields: localHourand localDay. I expect a lot of overlaps, and I would like to determine where most overlaps occur. My current way of doing it is this.
if(TempStats.findOne({
localHour: hours,
localDay: day
})){
TempStats.update({
localHour: hours,
localDay: day
},{
$inc: {freq: 1}
})
} else {
TempStats.insert({
localHour: hours,
localDay: day,
freq: 1
});
}
Essentially, this code runs every time I have new data that I want to insert. It works fine at the moment, so after entering all the data, I can sort by frequency to find the most frequent number of hours and days ( TempStats.find({}, {sort: {freq: -1}}).fetch()).
. , , , . , , . Mongo ( MiniMongo) ?
!