指定要返回的多个字段的正确语法是什么?
当指定一个字段时,我在光标中返回结果没有任何问题:
#Field specifications
fields <- mongo.bson.from.list(list(text = 1L))
我尝试了多种替代方法来指定多个字段,但似乎找不到正确的语法。下面是一个例子:
#Field specifications
fields <- mongo.bson.from.list(list(_id = 0L, text = 1L, name = 1L))
我也尝试在 find 语句中进行规范:
cursor <- mongo.find(mongo, "twitter.test", query,
fields = list(_id = 0L, text = 1L, name = 1L),
sort = count_sort,
limit = 1L)
这似乎是一个简单的问题,但我无法得到我正在寻找的结果。任何帮助将不胜感激!