Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

group by in ruby mongoid

Lead.where(client_id: client.id.to_s).collection.aggregate([{"$group"=>{ :_id=> "$sales_id" , :count=>{"$sum"=>1} } }, {"$match": { count: { "$gte": 3 } }} ]).to_a
 
PREVIOUS NEXT
Tagged: #group #ruby #mongoid
ADD COMMENT
Topic
Name
2+1 =