我正在努力学习MongoDB,以及它如何对我的分析有用.我只是在玩他们网站上的JavaScript控制台,并创建了以下项目:
{"title": "Cool", "_id": {"$oid": "503e4dc0cc93742e0d0ccad3"}, "tags": ["twenty", "sixty"]}
{"title": "Other", "_id": {"$oid": "503e4e5bcc93742e0d0ccad4"}, "tags": ["ten", "thirty"]}
{"title": "Ouch", "_id": {"$oid": "503e4e72cc93742e0d0ccad5"}, "tags": ["twenty", "seventy"]}
{"title": "Final", "_id": {"$oid": "503e4e72cc93742e0d0ccad6"}, "tags": ["sixty", "seventy"]}
我想做的是查询,以便获得所有这些对象的唯一标记列表.结果应该是这样的:
["ten", "twenty", "thirty", "sixty", "seventy"]
我该如何查询?我正试着打distinct()
分,但电话总是失败,甚至连询问都没有.