import asynciofrom motor.motor_asyncio import AsyncIOMotorClientdb = AsyncIOMotorClient().client.motor_asyncio@asyncio.coroutinedef async_func(loop):yield from db.test.remove()yield from db.test.insert({'foo': 111})x = yield from db.test.find_one()print(x)yield from db.test.find()loop = asyncio.get_event_loop()loop.run_until_complete(async_func(loop))
{'foo': 111, '_id': ObjectId('55a641f7444bcb19b0e18a7e')}Traceback (most recent call last):File "test_motor.py", line 20, in <module>loop.run_until_complete(async_func(loop))File "/home/imbolc/.pyenv/versions/3.4.3/lib/python3.4/asyncio/base_events.py", line 316, in run_until_completereturn future.result()File "/home/imbolc/.pyenv/versions/3.4.3/lib/python3.4/asyncio/futures.py", line 275, in resultraise self._exceptionFile "/home/imbolc/.pyenv/versions/3.4.3/lib/python3.4/asyncio/tasks.py", line 234, in _stepresult = coro.throw(exc)File "test_motor.py", line 16, in async_funcyield from db.test.find()RuntimeError: Task got bad yield: MotorCursor(<pymongo.cursor.Cursor object at 0x7f4dde7cd9e8>)Exception ignored in:shell returned 1
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/dd19269a-c985-4bb2-97de-72350c0d25bb%40googlegroups.com.--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to a topic in the Google Groups "mongodb-user" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mongodb-user/k7qmKR5x7-8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.