Skip to content

Instantly share code, notes, and snippets.

@axce1
Created December 16, 2013 16:30
Show Gist options
  • Save axce1/7989908 to your computer and use it in GitHub Desktop.
Save axce1/7989908 to your computer and use it in GitHub Desktop.

Revisions

  1. axce1 created this gist Dec 16, 2013.
    14 changes: 14 additions & 0 deletions gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    from pymongo import Connection

    class MongoDB:
    def __init__(self, dbname):
    self.conn = Connection('localhost', 27017)
    self.db = self.conn[dbname]

    def createCollection(self, name=''):
    return self.db[name]


    if __name__ == '__main__':
    database = MongoDB("test")
    collection = database.createCollection('testCollection')