code: def create_mongo_db(database_name, collection_name, initial_document):
      
      response_dict = {}
      try:
          mongodb_client_url = getattr(settings, 'MONGODB_CLIENT',
                                   'mongodb://localhost:27017/')
          mc = MongoClient(mongodb_client_url,document_class=OrderedDict)
  
          db = mc[str(database_name)]
          collection = db[str(collection_name)]
  
          d = json.loads(initial_document, object_pairs_hook=OrderedDict)
  
          collection.save(d)
  
      except:
          # error connecting to mongodb
          response_dict['error'] = str(sys.exc_info())
  
      return response_dict
docs: Create a new database and collection by inserting one document.