I have a 34 GB json file that has many data inside. I tried to import into my mongodb by using mongoimport --file file.json - but it failed ofcourse the file is too big and threw a memory system throw error you know it. Is it possible to use php code to iterate through the file with a cursor? I want to know how the file is build, but I do not know how to view an example array of it. From the source I could get an example array:
{
"_id": ObjectId("53b29644aafd413977b23b7e"),
"summonerId": NumberLong(24570940),
"region": "euw",
"updatedAt": NumberLong(1404212804),
"season": NumberLong(4),
"stats": {
"110": {
"totalSessionsPlayed": NumberLong(3),
"totalSessionsLost": NumberLong(2),
"totalSessionsWon": NumberLong(1),
"totalChampionKills": NumberLong(34),
"totalDamageDealt": NumberLong(415051),
"totalDamageTaken": NumberLong(63237),
"mostChampionKillsPerSession": NumberLong(12),
"totalMinionKills": NumberLong(538),
"totalDoubleKills": NumberLong(5),
"totalTripleKills": NumberLong(1),
"totalDeathsPerSession": NumberLong(18),
"totalGoldEarned": NumberLong(40977),
"totalTurretsKilled": NumberLong(6),
"totalPhysicalDamageDealt": NumberLong(381668),
"totalMagicDamageDealt": NumberLong(31340),
"totalAssists": NumberLong(25),
"maxChampionsKilled": NumberLong(12),
"maxNumDeaths": NumberLong(10)
}
}
}
The field stats contains more arrays, 110 is just an example. How can I iterate through this big sized file or how can I import it into my mongodb? For example; I want to echo summonerid,championid (which is 110 in this case),totalSessionsPlayed. It has to reloop as much as it needs until theres no championid left for this particular summonerid.
Again... A summonerID has a list of champions that it has been playing in his playing career. Champions are referring to (in this example) 110. Every single summonerid can contain multiple champions and I want to have all champions, how many times the champion has been played (totalsessionplayed) by summonerid.