title: How to dump json files into mongodb?
body: <p>I have few hundred JSON files which I want to insert into mongo database. I have written this code but it's not working. I'm getting error as </p>
  
  <pre><code>TypeError: 'str' object does not support item assignment
  </code></pre>
  
  <p>The code is below:</p>
  
  <pre><code>import glob
  from pymongo import MongoClient
  
  client = MongoClient('localhost',27017)
  path = '/home/rahul/Desktop/*.json'
  files = glob.glob(path)
  db = client.helloworld
  c = db.docs
  for f in files:
      c.insert(f)
  </code></pre>