Reputation: 1
I am trying to import a JSON file into MongoDb using Mongoimport. It throws the following error Failed: error processing document #1: read C:\Users\mbryant2\Documents\primer-dataset.json: The handle is invalid.
Here is my cmd:
$ mongoimport --db tempTestDb --collection restaurants --drop --file C:/Users/mbryant2/Documents/primer-dataset.json
and response:
2018-09-14T12:17:36.337-0600 connected to: localhost 2018-09-14T12:17:36.338-0600 dropping: tempTestDb.restaurants 2018-09-14T12:17:36.339-0600 Failed: error processing document #1: read C:\Users\mbryant2\Documents\primer-dataset.json: The handle is invalid. 2018-09-14T12:17:36.339-0600 imported 0 documents
Anyone have any ideas on what I am missing? Is it needing login credentials or something like that?
Upvotes: 0
Views: 965
Reputation: 476
If the data is represented as a JSON array, rather than individual lines of JSON text, you will need to add the --jsonArray
parameter to mongoimport.
Upvotes: 0