Trying to import simple data (see below), gets me an error "Operation passed in cannot be an array" in Compass 1.29.6
This error makes no sense to me, as the outer object is not an array. Sure, the first object contains an array, but how is this not importable, since it is valid JSON? What is it expecting?
I have checked the documentation for Compass, perused other similar errors, no answers are obvious or relevant enough to help me.
{
"Name": "root",
"ID": 0,
"Children": [{
"Name": "Chocolates",
"ID": 1,
"ParentID": 0
}]
}
3
Answers
This has been an open issue on github for over 4 years now with no real solution from compass. Every suggestion is pretty hacky and the only real solutions seem to be to not use Compass https://github.com/mongo-express/mongo-express/issues/433
MongoDB Compass accepts documents in unformatted json structure, I used http://json.dylansweb.com/ to un-format the json and it worked fine in Compass.
I am a bit late but try to wrap your object into array like
it will work