如何使用Java代码从MongoDB集合中获取不重复计数?

huangapple 未分类评论51阅读模式
英文:

How to fetch distinct count from a MongoDB collection using Java code?

问题

这是我的 MongoDB 查询:

db.getCollection('xyz').distinct("uid", {
    p_id: "abc",
    action: "mno",
    time_lo_res: {
        $gt: new ISODate("2020-06-22T04:00:00") * 1,
        $lt: new ISODate("2020-06-23T04:00:00") * 1
    }
}).length

我应该如何在 Java 控制台应用程序中获取这个数量?

英文:

This is my MongoDB query:

db.getCollection('xyz').distinct("uid",{p_id:"abc",action:"mno",time_lo_res:{$gt:new ISODate("2020-06-22T04:00:00")*1 , $lt:new ISODate("2020-06-23T04:00:00")*1} }).length

How can I fetch this count in a Java console application

huangapple
  • 本文由 发表于 2020年7月23日 15:51:59
  • 转载请务必保留本文链接:https://java.coder-hub.com/63049413.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定