Lorena Santana
Lorena Santana

Reputation: 21

Import JSON to MONGODB

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

Upvotes: 0

Views: 141

Answers (1)

user3902384
user3902384

Reputation:

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

Upvotes: 2

Related Questions