Started to learn MongoDB + node.js. For practice I want to create webapp which collect data and draw infographic. But I have very big problem with choosing data model for MongoDB base.
How it works now, but I think it's bad structure.
My service retrieving all data from API every hour and collecting it in collection "accounts". Every experience value from every hour in special object "expStart" with unique key which generated by request time. Structure of one document from collection "accounts" :
{
"_id" : ObjectId("54bd56cb699f4890160aacc9"),
"name" : "Shubiii",
"characters" : [
{
"online" : false,
"rank" : 562,
"dead" : false,
"name" : "ShrupShurp",
"league" : "hardcore",
"level" : 93,
"class" : "Ranger",
"experience" : 2515197599,
"expStat" : {
"dd2015_1_19_19_9" : 122120,
"dd2015_1_19_20_11" :45222
}
},
{
"online" : false,
"rank" : 563,
"dead" : false,
"name" : "ShrupShurp2",
"league" : "hardcore",
"level" : 93,
"class" : "Ranger",
"experience" : 2515197599,
"expStat" : {
"dd2015_1_19_19_9" : 3122120,
"dd2015_1_19_20_11" :21212
}
}
],
"challenges" : {
"total" : 3
},
"twitch" : {
"name" : ""
}
}
This is API data structure (http://ift.tt/1mtPFnj):
{
"total": 15000,
"entries": [
{
"online": false,
"rank": 2,
"dead": false,
"character": {
"name": "iamgodyi",
"level": 100,
"class": "Ranger",
"experience": 4250334444
},
"account": {
"name": "TW_James",
"challenges": {
"total": 0
},
"twitch": {
"name": "destiny601"
}
}
},
{
"online": true,
"rank": 3,
"dead": false,
"character": {
"name": "xVisco",
"level": 100,
"class": "Templar",
"experience": 4250334444
},
"account": {
"name": "xVisco",
"challenges": {
"total": 0
}
}
}
]
}
Sorry for my English.
Aucun commentaire:
Enregistrer un commentaire