fix error for mongo version smaller than 3.4
This commit is contained in:
parent
16963a9cb2
commit
93ff42af46
|
@ -353,7 +353,10 @@ class SiteFeedAnnc
|
||||||
end
|
end
|
||||||
|
|
||||||
pipeline_to_get_count = pipeline.clone
|
pipeline_to_get_count = pipeline.clone
|
||||||
pipeline_to_get_count << {"$count" => "count"}
|
pipeline_to_get_count << {"$group" => {
|
||||||
|
_id: nil,
|
||||||
|
count: {"$sum" => 1}
|
||||||
|
}}
|
||||||
|
|
||||||
count_result = SiteFeedAnncDetail.collection.aggregate(pipeline_to_get_count).first
|
count_result = SiteFeedAnncDetail.collection.aggregate(pipeline_to_get_count).first
|
||||||
feeds_count = count_result ? count_result["count"] : 0
|
feeds_count = count_result ? count_result["count"] : 0
|
||||||
|
|
Loading…
Reference in New Issue