Refty / mongo-thingy

:leaves: Powerful schema-less ODM for MongoDB and Python (sync + async)
https://mongo-thingy.readthedocs.io
MIT License
68 stars 12 forks source link

Implement Cursor.delete() #25

Closed ramnes closed 2 years ago

ramnes commented 6 years ago

So that we can remove a bunch of documents that exist from a cursor.

This is useful when we want to reuse a cursor rather than writing a new remove query.

For example:

class Foo(Thingy):
    def get_bars(self):
        return Bar.find({"foo_id": self.id})

    def delete_bars(self):
        return self.get_bars().delete()