【发布时间】:2014-10-17 11:35:49
【问题描述】:
在我的 Meteor 应用程序中,在服务器端,我需要从 Mongo 获取数据,必要时在 Mongo 中进行分析和更新。在数据库中,我有一个对象数组:
{ "0" : { "title" : "This is title", "description" : "This is description", "link" : "http://123435", "pubDate" : "16 Oct 2014 20:46:00 +0400" }, "1" : { }, "3" : { } etc
我正在尝试从 Mongo 获取数据:var savedNews = News.find().fetch(),News 是我的收藏。我在这种类型的调试器数组中看到:
0: "_id"="uuTOncmcIoIkfc",
1: "_id"="mcmroidewiuIpf"
etc
我知道这是 _id,但我需要访问对象的字段。如果我输入 db.news.find(); 在 Mongo 控制台中,我可以看到我的真实对象;如何获取数组或对象形式的数据?
谢谢。
【问题讨论】: