知识卡片

问题卡 · 6281.b

先去重会改变逐封邮件统计

理解等级:中级

示例先用$addToSet收集互异To数组,再按这些数组长度计算“每封收件人数”,重复收件列表的多封邮件已被折叠。若目标是每封统计,应保留消息ID与原数组分别计数;若目标是互异列表或地址,应明确另用去重口径。一个大数组长度高于所有互异地址数并不矛盾,因为数组内部也可有重复。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • · 查看原书依据

      recipients_per_message_totals =\ sorted([len(recipients) for recipients in recipients_per_message]) # Demonstrate how to use $unwind followed by $group to collapse # the recipient

    参考来源

    - 位置:《社交网站的数据挖掘与分析(原书第2版)》第6章《6.3.3 编写高级查询》(spine103;extracted/OReilly精品图书系列共21册(《Javascript权威指南》、《机器学习:实用案例解析》、《编写可读代码的艺术》、《算法精解》等)/_epub-src/text/part0092.html;u098-ch06-031)。 - 结论依据:原文在“recipients_per_message_totals”附近的定义、例子或代码支撑本卡核心说明:示例先用$addToSet收集互异To数组,再按这些数组长度计算“每封收件人数”,重复收件列表的多封邮件已被折叠。边界按已读前提解释;示例未执行。 - 原始内容:recipients_per_message_totals =\ sorted([len(recipients) for recipients in recipients_per_message]) # Demonstrate how to use $unwind followed by $group to collapse # the recipient