Apache
Windows
Python

软件简介

APyMongo - 是一个基于 Tornado 的异步版本的
pyMongo

示例代码:

import json
import tornado.web

import apymongo 
from apymongo import json_util

class TestHandler(tornado.web.RequestHandler):

    @tornado.web.asynchronous
    def get(self):     
        connection = apymongo.Connection()      
        collection = conn['testdb']['testcollection']
        coll.find_one(callback=self.handle)

    def handle(self,response):
        self.write(json.dumps(response,default=json_util.default))
        self.finish()