I've got a CSV file where there a column fill with Array data, written as ['foo', 'bar', 'baz'] in the file.
Manufacturer;EngineCount;ImagesURL
Boeing,2,['https://url.com/image1', 'https://url.com/image2', 'https://url.com/image3']
Airbus,4,['https://url.com/image1', 'https://url.com/image2', 'https://url.com/image3']
I can't find a way to import it as an Array in MongoDB (4.2+), it's always imported as string
"['https://url.com/image1', 'https://url.com/image2', 'https://url.com/image3']".
Maybe it's not possible with .csv file.
So I found a solution on stackoverflow where we update the fields to parse them as an array using JSON.parse function. But I new to MongoDB and I can't success to update the field with old value in MongoDB :
I tried
db.planes.updateMany({}, {$set: {ImagesURL:JSON.parse("$ImagesURLS")}}).
It's return error SyntaxError: Unexpected token $ in JSON at position 0
Where is my mistake ?
Thank you.