Inputting a Json object into a mongodb using meteor -


i'm attempting insert api response mongo db, doesn't save individual fields.

input here

playerslist.insert(meteor.http.get("api call here")); 

here response call:

{"hnub": {    "id": 21098134,    "name": "hnub",    "profileiconid": 20,    "revisiondate": 1428613578000,    "summonerlevel": 30 }} 

is there simple way cleanly saving fields?

the response of http call object content (string), data (javascript object if can parsed json), headers, , statuscode. recommend run code see actual response:

console.log(meteor.http.get("api call here")); 

if turns out response includes parsed json under data field, accomplish want with:

playerslist.insert(meteor.http.get("api call here").data); 

note, synchronous way of making api call work server. @ethaan points out, you'll need use callback client , you'll have overcome cross domain restrictions.


Popular posts from this blog