title: Writing a simple MongoDB module in python
body: <p>I have started writing a simple module for mongodb to use. I am new to python and I have been a problem with the code I wrote:</p>
  
  <pre><code>import pymongo
  
  
  class mongoDB():
  
      conn = object
  
      def __init__(self):
          global conn
          self.conn = pymongo.Connection("localhost",27017)
  
      def CreateCollection(self,name =""):
          self.dbCollection  = conn.name
          return self.dbCollection
  
  if __name__ == '__main__':
      database = mongoDB
      collection = database.CreateCollection("Hello")
  </code></pre>
  
  <p>Firstly I think there are probably few things wrong with my code if you can spot it and correct me. Also I am keep getting this erro:</p>
  
  <pre><code>collection = database.CreateCollection("Hello")
  TypeError: unbound method CreateCollection() must be called with mongoDB      
  
  instance as first argument (got str instance instead)
  </code></pre>
  
  <p>I want to be able to create the connection in the constructor of the class and then have a method for creating a collection and returning it, and also another method to insert delete and update the entities</p>