Skip to content

Instantly share code, notes, and snippets.

@ageron
Created April 8, 2013 17:01
Show Gist options
  • Save ageron/5338455 to your computer and use it in GitHub Desktop.
Save ageron/5338455 to your computer and use it in GitHub Desktop.
>>> from mongoengine import *
>>> class FacebookUser(Document):
... meta = { "allow_inheritance": False }
... facebook_id = StringField(primary_key = True, max_length = 20)
...
>>> connect("test")
Connection('localhost', 27017)
>>> FacebookUser.objects.delete()
>>> FacebookUser.objects
[]
>>> FacebookUser.objects.get_or_create(facebook_id = "1234")
(<FacebookUser: FacebookUser object>, True)
>>> FacebookUser.objects
[]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment