Are there any plans to add support for mongodb/motor?
It's an async MongoDB driver for facebook/tornado.
+1 I'm developing a webapp using Pypy that would benefit from supporting this.
Currently not - as I haven't had time to consider how I could implement it and keep the api as well.
Happy to start the conversation here about possible apis :)
Signed i want motor support too. But i'm sure this would be very difficult to do.
+1
I want it
:D Its great to have so much support I'll let Jesse know!
Anyone tried doing a prototype yet?
I can only use ...
A good starting point: Differences between Motor and PyMongo
I'm slowly looking into this.
:+1: after a year later.
anything new on this? It would be very good to have , because Tornado is quickly growing async web framework and motor is its main database driver, due to most of Tornadoers go for Mongodb.
We have to use schematics and manually save to mongodb for now.
I spoke with @heynemann personally, a maintainer of motorengine - http://motorengine.readthedocs.org/en/latest/, and us may be start a new branch with multi backend layer support, do you think about this idea: @rozza, @lig, @yograterol, @hmarr and @thedrow ?
Very good to know!
ping @rozza ?
Oh I want this!
Would be good :+1: - maybe ditch some of the old cruft and simplify in the process :)
SitRep?
@wpjunior We'd love to merge this if possible.
Any progress of this? almost 2 years now.
Would love to see this :+1:
would also love to see this! :+1:
@heynemann Any chance you got the time to work on this?
Not any time soon, I don't think so... Sorry. I would LOVE for this to happen. But for me to tackle it, I'd have to have a profound understanding of mongoengine's codebase.
+1
I tried to evaluate the workload to add async support to mongoengine.
From my experience, the codebase is not really fitted to support multiple drivers, and especially async and sync ones at the same time.
For example to work with Python3.5's await syntax you must declare your function as a asyncio.coroutine:
class Document:
@asyncio.coroutine
def create():
...
However this is invalid for a synchronous driver (or even for a driver that returns a generator such as txmongo). One solution could be to create a decorator that apply a asyncio.coroutine only if needed:
def on_needed_coroutine(fn):
if USED_DRIVER == 'motor.AsyncIOMotor':
return asyncio.coroutine(fn)
else:
return fn
class Document:
@on_needed_coroutine
def create():
...
As you can see, this create moving pieces and complexity (same thing for validating references which needs to be run async style for another example).
I think @heynemann's motor implementation of mongoengine seems a much simpler approach because it is limited to a single driver. So I'm wondering if it would not be a better approach (I didn't do any evalaution of this though) to make motorengine depends on mongoengine for everything but the motor-related stuff. This way motorengine could integrate most of mongoengine's patches with few efforts.
I personally end up writing my own mongo ODM: umongo (part of the reasons I'm not as much involved in mongoengine as I used to be ^^), which was designed from it core to provide multi-drivers, sync/async support.
Take a look at https://pypi.python.org/pypi/mongomotor
Take a look at https://github.com/Scille/umongo
$ pip install umongo[motor]
Any updates?
I believe @touilleMan 's post is still valid. There are currently no plan to support another driver than pymongo.
Most helpful comment
I tried to evaluate the workload to add async support to mongoengine.
From my experience, the codebase is not really fitted to support multiple drivers, and especially async and sync ones at the same time.
For example to work with Python3.5's
awaitsyntax you must declare your function as aasyncio.coroutine:However this is invalid for a synchronous driver (or even for a driver that returns a generator such as txmongo). One solution could be to create a decorator that apply a
asyncio.coroutineonly if needed:As you can see, this create moving pieces and complexity (same thing for validating references which needs to be run async style for another example).
I think @heynemann's motor implementation of mongoengine seems a much simpler approach because it is limited to a single driver. So I'm wondering if it would not be a better approach (I didn't do any evalaution of this though) to make motorengine depends on mongoengine for everything but the motor-related stuff. This way motorengine could integrate most of mongoengine's patches with few efforts.
I personally end up writing my own mongo ODM: umongo (part of the reasons I'm not as much involved in mongoengine as I used to be ^^), which was designed from it core to provide multi-drivers, sync/async support.