Skip to content

Instantly share code, notes, and snippets.

@namlook
Created September 26, 2013 12:25
Show Gist options
  • Save namlook/6713434 to your computer and use it in GitHub Desktop.
Save namlook/6713434 to your computer and use it in GitHub Desktop.
MongoKit simple example
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