Mongo 查询(可视化工具)
生活随笔
收集整理的這篇文章主要介紹了
Mongo 查询(可视化工具)
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
distinct
MongoDB 的 distinct 命令是獲取特定字段中不同值列表的最簡(jiǎn)單工具。
該命令適用于普通字段、數(shù)組字段以及數(shù)組內(nèi)嵌文檔(集合對(duì)象)。
db.getCollection('customer').distinct("customer_type")// chances字段的值是個(gè)集合,獲取集合內(nèi)每個(gè)對(duì)象的opportunitytype字段的值域db.getCollection('customer').distinct("chances.opportunitytype")統(tǒng)計(jì)某幾個(gè)人的共同好友:
db.person.distinct("myFriends", {"manName"?: {"$in"?: ["ZhenQin",?"YangYan"]}})使用 runCommand 命令來(lái)寫:
下面的示例返回 inventory 集合的?dept 字段的值域:
db.runCommand ( { distinct: "inventory", key: "dept" } )下面的示例返回 inventory 集合中 dept 取值為 "A" 的結(jié)果集中的 “item.sku” 字段的值域:
db.runCommand ( { distinct: "inventory", key: "item.sku", query: { dept: "A"} } )?
轉(zhuǎn)載于:https://www.cnblogs.com/zhangchaoran/p/9969610.html
總結(jié)
以上是生活随笔為你收集整理的Mongo 查询(可视化工具)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: day21 pickle json sh
- 下一篇: docker 出现 Error resp