I have the following json data I am trying to import into mongodb.
{
"subjectId": "63cd96779e66d518f3af574c",
"name":"Earth and Space Science",
"subtopics": [
{
"name": "Rocks, Soil and Minerals",
"questions": [
{
"question": "What type of rock is formed when magma cools and hardens?",
"multipleChoice":["Sedimentary", "Metamorphic", "Igneous", "All of the above"],
"answer": "Igneous"
}
]
}
]
}
I am getting the error: Operation passed in cannot be an array.
Do you know why?
2
Answers
Maybe, the Problem is the formatted json structure with you tabs and spaces, it has to be unformatted in a Oneliner.
Try this:
Refer to this.
MongoDB Compass has an unusual JSON file import format requirement in that each document must be delimited by a newline.
After formatting your JSON document file as required, MongoDB Compass imports your file normally. Hopefully Compass’s file import parser will become "smarter".