Import JSON to MONGODB
Question: I have a Python script that generates a huge JSON. When I put the program to
run, it generates a file in Notepad with JSON. I wanted to put this JSON in
MongoDB database and let stored, and then be able to search this JSON using
MongoDB commands to search for espercificas things. But could not find
anywhere how can I get this JSON file in the Notepad, and put in the database.
If anyone can help.

tanks


Answer: Go to file directory using cmd, outside mongoshell. Then,

    
    
    mongoimport --db dbName --collection collectionName <fileName.json
    

Example,

    
    
    mongoimport --db foo --collection myCollections < /Users/file.json
    connected to: *.*.*.*
    Sat Mar  2 15:01:08 imported 11 objects
    

