thank you for the reply :)
> Hi some answers inline:
> > 1 - in motor documentation there is:
>
> > Warning
> > It is a common mistake to create a new connection object for every
> > request; this comes at a dire performance cost. Create the connection
> > when your application starts and reuse that one connection for the
> > lifetime of the process, as shown in these examples.
> > so, how many connections there is this example:
>
> > class BaseHandler(tornado.web.RequestHandler):
> > @property
> > def db(self):
> > if not hasattr(BaseHandler,"_db"):
> > _db = motor.MotorConnection().open_sync().mydb
> > return _db
> > ...
>
> This doesnt work as expected as you never set _rs or _fs to the class
> BaseHandler. A nicer pattern might be to passing it into the
> application: Here's an example:
https://github.com/rozza/try-aggro/blob/master/server.py, so then you can
> refer to it in your application like so: db
> = self.application.settings['db']
this is because the first application i've learned is TuxHub, and he
used this technique to subclass handlers:
https://github.com/badubizzle/tuxhub/blob/master/handlers.py#L17
> You need to provide callbacks for the cursor, so that the query is actually
> run* -
> see:
http://emptysquare.net/motor/pymongo/api/motor/tutorial.html#querying....
> * motor.Op - actually runs the MongoDB operation and resumes the generator
> with the result of the operation when it is complete.
>
still learning the async :(
> > 3 - why do i get error when using
>
> > self.db.users.find_one({"_id":email})
> > ...
>
> is find_one in motor different from find_one in pymongo ?
>
>
>
> Yes it also is needs motor.Op to run the query eg:
>
http://emptysquare.net/motor/pymongo/api/motor/tutorial.html#getting-...
>
it is difficult to make transition! really difficult to a beginner or
there is a problem in my mind!
> Ross
thank you again :)