大佬教程收集整理的这篇文章主要介绍了node.js – mongodb聚合过滤器,用于具有大于或等于数字的字段的记录,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
{ count: 48,ISP: 'LEASEWEB USA',percentRisky: 100 },{ count: 51,ISP: 'ARETI INTERNET LTD',{ count: 82,ISP: 'TinET SPA',{ count: 109,ISP: 'GIGLINX',{ count: 142,ISP: 'EGIHOSTinG',{ count: 857,ISP: 'VERSAWEB,LLC',percentRisky: 100 }
下面是我的汇总查询.有没有办法让我只显示“count”字段大于500的结果?我已经尝试添加到项目阶段没有运气.
{ $match : { //match to documents which are from all clients,from last three days,and scored org : {"$in" : clientArray },frd : {$gt : new Date(JSON.Stringify(util.lastXDates( 3 )))},sl : true }},{ $group : { //group by isp,get @R_55_10586@l count,and get count of risky _id : "$gog",count : { $sum : 1 },countRisky : { $sum : { $cond : { if : { $gte : [ "$scr",65 ] },then : 1,else : 0 }} } }},{ $project : { //rename _id to isp,only show percent risky,and the count _id : 0,ISP : "$_id",percentRisky : { $multiply : [{ $divide : ["$countRisky","$count"] },100] },count : 1 }},{ $sort : { //sort by percent risky percentRisky : 1,count : 1
以上是大佬教程为你收集整理的node.js – mongodb聚合过滤器,用于具有大于或等于数字的字段的记录全部内容,希望文章能够帮你解决node.js – mongodb聚合过滤器,用于具有大于或等于数字的字段的记录所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。