Created
December 16, 2013 16:30
-
-
Save axce1/7989908 to your computer and use it in GitHub Desktop.
create mongoDB
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment