Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

_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?

>Solution :

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"
    }
]
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading