mongodb - How fetch data from mongo? -
in meteor application, on server side, need info mongo, analyse , update in mongo if neсessary. in database, have array of objects:
{ "0" : { "title" : "this title", "description" : "this description", "link" : "http://123435", "pubdate" : "16 oct 2014 20:46:00 +0400" }, "1" : { }, "3" : { } etc
i'm seek info mongo: var savednews = news.find().fetch(), there news collection. , see in debugger array of type:
0: "_id"="uutoncmcioikfc", 1: "_id"="mcmroidewiuipf" etc
i understand _id's, need access fields of objects. in mongo console can see real objects if type db.news.find(); how can info in form of array or object?
thank you.
fetch() homecoming array, records can expanded, if not, maybe don't publish of data. example, should able info this:
temp = collection.find({_id:"1"}).fetch(); temp[0].variable
or simply
temp = collection.find({_id:"1"}).fetch()[0].variable;
if need 1 record seek using findone, homecoming 1 array, no utilize of fetch() or [] required
mongodb meteor
No comments:
Post a Comment