mongodb - How fetch data from mongo? -
itemprop = "text">
In my meteor application, on the server side, I need to get data from Mongo, if it's analyzed and updated in Mongo . In the database, I have an array of objects:
{"0": {"title": "This is the title", "description": "this description is", "link" : "Http: // 123435", "Pubadet": "16 October 2014 20:46:00 +0400"}, "1": {}, "3": {} etc.
< P> I am trying to get data from Mongo: var savedNews = news.find (). Fetch (), there's my archive. And I look at this type of debugger array: 0: "_id" = "uuTOncmcIoIkfc", 1: "_id" = "mcmroidewiuIpf" etc.
< P> I understand that this is _ID, but I need access to the areas of the object. In Mongo Console, I can see my real object if I type db.news.find (); How can I get data in the form of an array or object? Thank you.
Fetch () return an array, those records might extend to you, if not You may not publish all this data. For example, you should be able to get the data in such a way:
temp = Collection.find ({_ id: "1"}). Fetch (); Temp [0] .variable
or just
temp = archive. Search ({_ ID: "1"}). Fetch () [0] .variable;
If you only need one record, then try using a search, it returns only one array, so no use of fetch () or [] is required.
Comments
Post a Comment