Sabin789
Sabin789

Reputation: 15

mongoDB compass database makes every letter a new element

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?

Upvotes: 0

Views: 48

Answers (1)

Takis
Takis

Reputation: 8695

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"
    }
]

Upvotes: 1

Related Questions