Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for tailable cursors #16

Open
vd2org opened this issue Oct 24, 2020 · 2 comments
Open

Support for tailable cursors #16

vd2org opened this issue Oct 24, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@vd2org
Copy link

vd2org commented Oct 24, 2020

Support for tailable cursors in engine.find call:

https://motor.readthedocs.io/en/stable/examples/tailable-cursors.html

@art049 art049 added the enhancement New feature or request label Oct 24, 2020
@art049
Copy link
Owner

art049 commented Oct 24, 2020

Hi, can you describe the behavior you would like to have with the current AIOCursor ?

@vd2org
Copy link
Author

vd2org commented Oct 28, 2020

Hi! Same as simple find, but I want to wait until new documents come in.
This will be useful, for example, for implementing event notifications over websocket.

Something like that:

async for rec of engine.find(EventsModel, EventsModel.timestamp >= datetime.utcnow().timestamp(), tailable=True):
   await websocket.send(dict(rec))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants