how to add json file to mongodb 1

how to add json file to mongodb

mongoimport --jsonArray  -d DatabaseN -c collectionName /filePath/filename.json

Here is what the above code is Doing:
1. We’re using the mongoimport command to import data into MongoDB.
2. The –jsonArray flag is used to indicate that the input file is a JSON array.
3. The -d flag is used to specify the database name.
4. The -c flag is used to specify the collection name.
5. The /filePath/filename.json is the path to the file that we want to import.

Similar Posts