odmantic
odmantic copied to clipboard
Support for tailable cursors
Support for tailable cursors in engine.find call:
https://motor.readthedocs.io/en/stable/examples/tailable-cursors.html
Hi, can you describe the behavior you would like to have with the current AIOCursor ?
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))