fix counter eval

This commit is contained in:
Matt K. Fu 2013-08-27 16:07:58 +08:00
parent 69ef8fa747
commit aa8523c8cf
1 changed files with 1 additions and 1 deletions

View File

@ -7,7 +7,7 @@ module OrbitApp
map = "function(){ emit( this.referrer,{session_hash: this.session_hash,created_at: this.created_at}); };"
reduce = "function(key, values){ var sum = 0; values.forEach(function(doc){sum += doc.amount; }); return {amount: sum};};"
if options.blank?
impressions = Impression.count #collection.map_reduce(map, reduce,read: :primary, out: "vr")
impressions = Impression.collection.map_reduce(map, reduce,read: :primary, out: "vr")
else
query = Impression.where(options).selector
impressions = Impression.where(options).collection.map_reduce(map, reduce,read: :primary, out: "vr",:query=>query)