当前位置: 首页 > news >正文

cms网站开发价格怎么做网络推广优化

cms网站开发价格,怎么做网络推广优化,wordpress 多说 登陆,现在用什么软件做网站按照指定的表达式对输入文档进行分类后放入指定数字的桶中&#xff0c;跟$bucket不太一样&#xff0c;$bucketAuto可以指定分组的数量&#xff08;颗粒度&#xff09;&#xff0c;$bucketAuto会根据groupBy的值和颗粒度自动生成桶的边界。 语法 {$bucketAuto: {groupBy: <…

按照指定的表达式对输入文档进行分类后放入指定数字的桶中,跟$bucket不太一样,$bucketAuto可以指定分组的数量(颗粒度),$bucketAuto会根据groupBy的值和颗粒度自动生成桶的边界。

语法

{$bucketAuto: {groupBy: <表达式>,buckets: <数字>,output: {<输出1>: { <$accumulator 表达式> },...}granularity: <字符串>}
}

groupBy

表达式,对文档进行分组的表达式。若指定字段路径,需要在字段名前加上美元符号$并用引号引起来,如:$field_name

buckets

整数,32位的正整数,指定桶的数量也就是输入文档分组的数量。

output

文档,可选,指定了输出文档中除_id字段外要包含的其他字段,必须要使用汇总(累加器)表达式:

<输出字段1>: { <accumulator>: <表达式1> },
...

如果指定了输出字段,则count字段不会自动添加,需要的话要手动添加。如果不指定输出字段则默认添加一个count字段。

output: {<输出字段1>: { <accumulator>: <expres表达式1sion1> },...count: { $sum: 1 }
}

每个桶文档包含:

  • 一个桶边界下限的_id
    • _id.min字段指定了桶边界的下限(含)。
    • _id.max字段指定了桶边界的上限(不含)。除系列中的最后一个桶外,该界限对所有桶都是排他性的,因为在最后一个桶中,该界限是包含的。
  • count字段,包含文件桶中的文件数量。如果未指定输出文档,则默认包含count字段。

granularity

可选,字符串,指定了一个字符串,用于指定首选数列,以确保计算的边界边缘以首选的整数或其10的幂次结束。只有当所有groupBy值都是数值且都不是NaN时才有效。

支持的颗粒度:“R5”,“R10”,“R20”,“R40”,“R80”,“1-2-5”,“E6”,“E12”,“E24”,“E48”,“E96”,“E192”,“POWERSOF2”。

说明

如果出现以下情况,桶数量可能少于指定数量:

  • 输入文件的数量少于指定的文件桶数量。
  • groupBy表达式的唯一值数量少于指定的存储桶数量。
  • 粒度的间隔数少于桶数。
  • 粒度不够精细,无法将文档均匀分布到指定数量的桶中。

groupBy字段的粒度或唯一值的数量决定了文档是否能均匀分布到不同的桶。如果粒度不够,$bucketAuto阶段可能无法将结果均匀地分配到各个桶。

粒度

$bucketAuto接受一个可选的粒度参数,确保所有数据桶的边界都遵循指定的首选数列。使用首选数列可以更好地控制分组表达式中数值范围内的数据桶边界。当groupBy表达式的范围以指数形式扩展时,还可以使用首选数列帮助对数和均匀地设置数据桶边界。

雷纳数列

雷纳数列是通过取105次方根、10次方根、20次方根、40次方根或80次方根,然后将相当于1.0到 10.0(R80 为 10.3)之间数值的根的各种幂包含在内而得出的一组数字。

将粒度设置为 R5、R10、R20、R40 或 R80,可将数据桶边界限制为系列中的值。当 groupBy 值超出 1.0 至 10.0(R80 为 10.3)范围时,系列值将乘以 10 的幂。

R5 数列以 10 的五次方根 1.58 为基础,包括该根的各种幂次(四舍五入),直至 10。R5 数列的推导过程如下:

例如:

  • 10 0/5 = 1
  • 10 1/5 = 1.584 ~ 1.6
  • 10 2/5 = 2.511 ~ 2.5
  • 10 3/5 = 3.981 ~ 4.0
  • 10 4/5 = 6.309 ~ 6.3
  • 10 5/5 = 10

同样的方法也适用于其他雷纳系列,以提供更精细的粒度,即 1.0 和 10.0 之间的更多间隔(R80 为 10.3)。

E 序列

E 数字系列与雷纳数列类似,它们以特定的相对误差将 1.0 到 10.0 的区间细分为10的6、12、24、48、96或192的次方根。

将粒度设置为 E6、E12、E24、E48、E96 或 E192,可将桶边界限制为序列中的值。当 groupBy 值超出 1.0 到 10.0 的范围时,系列值将乘以 10 的幂。

1-2-5 序列

1-2-5 数列类似于三值数列雷纳数列。

将粒度设为 1-2-5,可将桶边界限制为 10 的三次根的各种幂,四舍五入到一位有效数字。

例如,以下数值属于 1-2-5 系列:0.1、0.2、0.5、1、2、5、10、20、50、100、200、500、1000 等…

2的次幂序列

将粒度设置为 POWERSOF2,限制桶边界为2的次幂

以下数字遵循2的幂序列:

  • 2^0 = 1
  • 2^1 = 2
  • 2^2 = 4
  • 2^3 = 8
  • 2^4 = 16
  • 2^5 = 32

一种常见的实现方式是,各种计算机组件(如内存)通常都遵守POWERSOF2的首选数字集:1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, …

不同粒度的比较

下面的操作演示了指定不同的粒度值如何影响$bucketAuto确定桶边界的方式。集合的_id从 0 到 99:

{ _id: 0 }
{ _id: 1 }
...
{ _id: 99 }

不同的粒度值会被代入到下面的操作中:

db.things.aggregate( [{$bucketAuto: {groupBy: "$_id",buckets: 5,granularity: <granularity>}}
] )

下表中的结果显示了不同的粒度值如何产生不同的桶边界:

粒度结果说明
无粒度{ “_id” : { “min” : 0, “max” : 20 }, “count” : 20 }{ “_id” : { “min” : 20, “max” : 40 }, “count” : 20 }{ “_id” : { “min” : 40, “max” : 60 }, “count” : 20 }{ “_id” : { “min” : 60, “max” : 80 }, “count” : 20 }{ “_id” : { “min” : 80, “max” : 99 }, “count” : 20 }
R20{ “_id” : { “min” : 0, “max” : 20 }, “count” : 20 }{ “_id” : { “min” : 20, “max” : 40 }, “count” : 20 }{ “_id” : { “min” : 40, “max” : 63 }, “count” : 23 }{ “_id” : { “min” : 63, “max” : 90 }, “count” : 27 }{ “_id” : { “min” : 90, “max” : 100 }, “count” : 10 }
E24{ “_id” : { “min” : 0, “max” : 20 }, “count” : 20 }{ “_id” : { “min” : 20, “max” : 43 }, “count” : 23 }{ “_id” : { “min” : 43, “max” : 68 }, “count” : 25 }{ “_id” : { “min” : 68, “max” : 91 }, “count” : 23 }{ “_id” : { “min” : 91, “max” : 100 }, “count” : 9 }
1-2-5{ “_id” : { “min” : 0, “max” : 20 }, “count” : 20 }{ “_id” : { “min” : 20, “max” : 50 }, “count” : 30 }{ “_id” : { “min” : 50, “max” : 100 }, “count” : 50 }指定的桶数超过系列中的间隔数。
POWERSOF2{ “_id” : { “min” : 0, “max” : 32 }, “count” : 32 }{ “_id” : { “min” : 32, “max” : 64 }, “count” : 32 }{ “_id” : { “min” : 64, “max” : 128 }, “count” : 36 }指定的桶数超过系列中的间隔数。

举例

下面的文档是收藏艺术品的集合:

{ "_id" : 1, "title" : "The Pillars of Society", "artist" : "Grosz", "year" : 1926,"price" : NumberDecimal("199.99"),"dimensions" : { "height" : 39, "width" : 21, "units" : "in" } }
{ "_id" : 2, "title" : "Melancholy III", "artist" : "Munch", "year" : 1902,"price" : NumberDecimal("280.00"),"dimensions" : { "height" : 49, "width" : 32, "units" : "in" } }
{ "_id" : 3, "title" : "Dancer", "artist" : "Miro", "year" : 1925,"price" : NumberDecimal("76.04"),"dimensions" : { "height" : 25, "width" : 20, "units" : "in" } }
{ "_id" : 4, "title" : "The Great Wave off Kanagawa", "artist" : "Hokusai","price" : NumberDecimal("167.30"),"dimensions" : { "height" : 24, "width" : 36, "units" : "in" } }
{ "_id" : 5, "title" : "The Persistence of Memory", "artist" : "Dali", "year" : 1931,"price" : NumberDecimal("483.00"),"dimensions" : { "height" : 20, "width" : 24, "units" : "in" } }
{ "_id" : 6, "title" : "Composition VII", "artist" : "Kandinsky", "year" : 1913,"price" : NumberDecimal("385.00"),"dimensions" : { "height" : 30, "width" : 46, "units" : "in" } }
{ "_id" : 7, "title" : "The Scream", "artist" : "Munch","price" : NumberDecimal("159.00"),"dimensions" : { "height" : 24, "width" : 18, "units" : "in" } }
{ "_id" : 8, "title" : "Blue Flower", "artist" : "O'Keefe", "year" : 1918,"price" : NumberDecimal("118.42"),"dimensions" : { "height" : 24, "width" : 20, "units" : "in" } }

单面聚合

在下面的操作中,输入文档将根据price字段中的值分成四组:

db.artwork.aggregate( [{$bucketAuto: {groupBy: "$price",buckets: 4}}
] )

该操作会返回以下文件:

{"_id" : {"min" : NumberDecimal("76.04"),"max" : NumberDecimal("159.00")},"count" : 2
}
{"_id" : {"min" : NumberDecimal("159.00"),"max" : NumberDecimal("199.99")},"count" : 2
}
{"_id" : {"min" : NumberDecimal("199.99"),"max" : NumberDecimal("385.00")},"count" : 2
}
{"_id" : {"min" : NumberDecimal("385.00"),"max" : NumberDecimal("483.00")},"count" : 2
}

多面聚合

…。

可在$facet阶段内使用$bucketAuto,对输入文档artwork进行多个聚合管道处理。

下面的聚合管道根据priceyearareaartwork 中的文档分组:

db.artwork.aggregate( [{$facet: {"price": [{$bucketAuto: {groupBy: "$price",buckets: 4}}],"year": [{$bucketAuto: {groupBy: "$year",buckets: 3,output: {"count": { $sum: 1 },"years": { $push: "$year" }}}}],"area": [{$bucketAuto: {groupBy: {$multiply: [ "$dimensions.height", "$dimensions.width" ]},buckets: 4,output: {"count": { $sum: 1 },"titles": { $push: "$title" }}}}]}}
] )

操作返回以下内容:

{"area" : [{"_id" : { "min" : 432, "max" : 500 },"count" : 3,"titles" : ["The Scream","The Persistence of Memory","Blue Flower"]},{"_id" : { "min" : 500, "max" : 864 },"count" : 2,"titles" : ["Dancer","The Pillars of Society"]},{"_id" : { "min" : 864, "max" : 1568 },"count" : 2,"titles" : ["The Great Wave off Kanagawa","Composition VII"]},{"_id" : { "min" : 1568, "max" : 1568 },"count" : 1,"titles" : ["Melancholy III"]}],"price" : [{"_id" : { "min" : NumberDecimal("76.04"), "max" : NumberDecimal("159.00") },"count" : 2},{"_id" : { "min" : NumberDecimal("159.00"), "max" : NumberDecimal("199.99") },"count" : 2},{"_id" : { "min" : NumberDecimal("199.99"), "max" : NumberDecimal("385.00") },"count" : 2 },{"_id" : { "min" : NumberDecimal("385.00"), "max" : NumberDecimal("483.00") },"count" : 2}],"year" : [{ "_id" : { "min" : null, "max" : 1913 }, "count" : 3, "years" : [ 1902 ] },{ "_id" : { "min" : 1913, "max" : 1926 }, "count" : 3, "years" : [ 1913, 1918, 1925 ] },{ "_id" : { "min" : 1926, "max" : 1931 }, "count" : 2, "years" : [ 1926, 1931 ] }]
}
http://www.dinnco.com/news/28691.html

相关文章:

  • 找制作网站公司河南省网站
  • 网站安全建设模板下载安装百度提交入口的网址
  • 网站建设主要工作流程腾讯广告推广怎么做
  • 企业网站建设前期准备百度收录查询api
  • 海淀住房城乡建设委网站上百度seo公司整站优化
  • 贵州省住房和城乡建设官方网站百度竞价渠道代理
  • php动态网站开发案例答案第二章制作一个app软件需要多少钱
  • 网站上面的体验卡怎么做志鸿优化网下载
  • 平谷武汉阳网站建设如何做网页设计
  • 网站建设审核需要多长时间学生个人网页设计模板
  • 网络游戏吧百度seo优化技巧
  • 做网站数据需要的软件网站建设公司排行榜
  • 网上做翻译兼职网站好免费观看短视频的app软件推荐
  • 网站建设与管理工资做搜索引擎优化的企业
  • 网站建设费税率多少钱自贡网站seo
  • 网站导航条怎么做效果百度问答
  • 单位网站建设工作功劳seo教程之关键词是什么
  • 下载好的网站模板怎么用怎么创建网站赚钱
  • 山西疫情最新情况政策网络优化的流程
  • 做网站的关键词怎么判断好不好网站代运营价格
  • 做旅游网站目的和意义360网站推广怎么做
  • 济宁嘉祥网站建设长沙seo推广外包
  • 网站建设功能清单百度网站官网入口网址
  • 专业网站建设效果韶关seo
  • 网站建设的威胁可以入侵的网站
  • wordpress微信免签约支付插件上海seo网站排名优化公司
  • 计算机做网站开发需要什么证书免费建站建站abc网站
  • 广州 环保 凡人网站建设购买域名的网站
  • 网站建设价目注册网站怎么注册
  • 德语网站制作网络营销专业代码