[英]MongoDB find() which is retrieving only one property from the collection
I have a collection of blog posts where the structure of the records is {title, author, contents} and I want to retrieve all the names of all the authors I am doing this: 我有一个博客帖子集合,其中记录的结构为{title,author,contents},我想检索我正在执行的所有作者的所有姓名:
this.db.collection("ContentText").find("authors");
but my output is undefined
Can someone point out the error? 但是我的输出是
undefined
有人可以指出错误吗?
尝试这个:
this.db.collection("ContentText").distinct("author");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.