I have this dataset
_id: 654e312d4ff391e4ef2244ad
Id: 2
SepalLengthCm: 4.9
:3
PetalLengthCm: 1.4
PetalWidthCm: 0.2
Species: "Iris-setosa"
and mongodb recognize like this,
{
"Id": 2,
"SepalLengthCm": 4.9,
"PetalLengthCm": 1.4,
"PetalWidthCm": 0.2,
"Species": "Iris-setosa"
}
him ignore de “:3”, despite save them.
I tried rename, but doesn’t work because isn’t recognized “” by the mongo. something like:
db.collection.updateMany({}, { $rename: { "": "tmpName" } });
db.collection.updateMany({}, { $rename: { " ": "tmpName" } });
db.collection.updateMany({' ':3}, { $rename: { ' ': 'tmpName' } });
db.collection.updateMany({"",{$exists, true}}, { $rename: { "": "tmpName" } });
and similars …
I need put a header in “:3”
{
"Id": 2,
"SepalLengthCm": 4.9,
"tmpName":3,
"PetalLengthCm": 1.4,
"PetalWidthCm": 0.2,
"Species": "Iris-setosa"
}
that’s the idea, I need to import a csv without 1 header and I want to fix them. And mongo saves like this.