title: Bulk Import JSON documents into MongoDB
body: <p>I have a directory with 18K json documents. I'm trying to do a bulk import into MongoDB. I wrote this script in Python to load everything in. This code gives me a syntax error since it doesn't seem that Pymongo has 'mongoimport' function. How would I correct this code so that I could do a bulk import of json files from a directory. </p>
  
  <pre><code>import json 
  import glob 
  from pymongo import MongoClient 
  
  directory = '/home/mongo/data/*.json' 
  client = MongoClient("localhost", 27017) 
  db = client.nba 
  collection = db.test
  jsonFiles = glob.glob(directory) 
  
  for file in jsonFiles: 
      mongoimport --db nba --collection sigOptBox --file file
  </code></pre>