Home > Software engineering >  mongoDB compass database makes every letter a new element
mongoDB compass database makes every letter a new element

Time:05-05

So I try to import a json file in a database

{"name":"Mark",
"age":"25"
}

When I try to import the file I get it back like

0:"M"
1:"a"
2:"r"
3:"k"
_id:objectId('etc')

and then inside a whole other element

_id:objectId('etc')
value:25

The id is supposed to be there because i am using uuid but is the data meant to be displayed this way?

CodePudding user response:

I think mongodb-compass expects an array of documents, so try to wrap it with [] if you import json file. If you import json-document no need for [].

Like

[
    {
        "name":"Mark",
         "age":"25"
    }
]
  • Related