Skip to navigation
Purge all couchd docs with python
22.12.21
async def clean_logger(self, name): data = [] docs = [] db = await couch.get_db() selector = {"logger":{"$eq": name}} print("...getting docs") d = db.find(selector, limit=10000000, skip=None, sort=None, fields=["_id","_rev"], use_index=None, bookmark=None, update=True, conflicts=False) total = len(d['docs']) total_chunks = int(len(d['docs'])/100) print("...got docs {0}x".format(total)) chunks = list(zip(*[iter(d['docs'])]*100)) for i in chunks: print("...remaining chunks ", total_chunks) db.purge(i) total_chunks -=1 return data
https://pypi.org/project/CouchDB2/
Reply
Anonymous
Information Epoch 1732520595
Design programs to be connected to other programs.
Home
Notebook
Contact us