0

First of all this hasn't been asked before or if I asked there wasn't any answer provided so I am opening this new thread.

I need best way to dump a JSON file in mongodb. There could be multiple ways but I am looking for ways which gives good performance.

1 Answer 1

1

I have done this with pymongo. All you have to do is provide a list of dicts to insert_many.

mongoClient = pymongo.MongoClient("mongodb://%s:%s@host:port"% (username,password))
mongoClientDB = mongoClient['database-name']
collection = mongoClientDB['collection-name']
collection.insert_many(listOfDicts, ordered=False)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.