Created
September 26, 2013 12:25
-
-
Save namlook/6713434 to your computer and use it in GitHub Desktop.
MongoKit simple example
This file contains 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
import mongokit | |
connection = mongokit.Connection() | |
@connection.register | |
class Nugget(mongokit.Document): | |
__database__ = "elkorado" | |
__collection__ = "nuggets" | |
structure = { | |
"url": unicode, | |
"discoverer": unicode, | |
"topics": list, | |
"popularity": int | |
} | |
default_values = {"popularity": 0} | |
def is_popular(self): | |
""" this is for the example purpose """ | |
return self.popularity > 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment