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