mongoengine icon indicating copy to clipboard operation
mongoengine copied to clipboard

async backend and support

Open wpjunior opened this issue 14 years ago • 2 comments

for integration in async apps. Libs: https://github.com/facebook/tornado https://github.com/bitly/asyncmongo

wpjunior avatar Dec 05 '11 15:12 wpjunior

a prototype:



from mongoengine import *

set_backend('async')

class Animal(Document):
    nome = StringField()



def query_animals(animals, err):
    print animals

Animal.objects(nome__startswith="M",
               callback=query_animals,
               timeout=30)

def new_macaco(macaco, err):
    print macaco

Animal(nome="macaco").save(callback=new_macaco)

def distincts(nomes, err):
    print nomes

Animal.objects.distinct('nome', callback=distincts)

def delete_boi(err):
    print "deleted"

Animal.objects(nome="Boi").delete(callback=delete_boi)

wpjunior avatar Dec 08 '11 18:12 wpjunior

a notice: https://jira.mongodb.org/browse/PYTHON-296

wpjunior avatar Dec 12 '11 14:12 wpjunior