I have the following CSV:
matchId, score, players.Name, players.Goals
2730319610399, 5-0, John, 3
When I use mongoimport on Studio 3T it is imported in the form I need because of the dot notation:
{
"matchId" : "2730319610399",
"score" : "5-0",
"players" : {
"Name" : "John",
"Goals" : "3"
}
}
My issue is that the csv actually has one more player that I want to add in this import. The array of "players" has two entries.
This is the actual CSV format:
matchId, score, players.Name, players.Goals, players.Name, players.Goals
2730319610399, 5-0, John, 3, Kyle, 2
But this does not work and I get an error of:
Every row will be parsed as one column.
The header contains a duplicate name "players.Name" in columns: [3, 5]
Is it possible to format the CSV so that I can add multiple values into the "players" array? I was thinking of naming it something like players[0].Name and players[1].Name
But that doesn't work because it creates two arrays: players[0] and players[1]
This is what I need the database structure to look like:
{
"matchId" : "2730319610399",
"score" : "5-0",
"players" : {
"Name" : "John",
"Goals" : "3"
},
{
"Name" : "Kyle",
"Goals" : "2"
}
}