dmapper / docclean

Clean old documents and corresponding ops-collection in mongo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docclean

clean old documents and corresponding ops-collection in mongodb

Instalation

npm install -g docclean

Usage

as a cli tool

Usage: docclean -u [url] -d [num] -c [collections]

Options:
  -u, --url       mongodb url                                         [required]
  -d, --days      amount of days to preserve records                [default: 7]
  -c, --collections  collections to clean                             [required]

Examples:
  docclean -u mongodb://localhost:27017/idg -d 3 -c tasks
     
  # clean all 3-day old records from all task's collections including 
  # corresponding ops docs (sharedb and livedb) 

as a package

var cleaner = require('docclean');

cleaner('mongodb:/localhost:27017/mydb', 7, ['tasks'], function(err, results){
  // ...
});

About

Clean old documents and corresponding ops-collection in mongo


Languages

Language:JavaScript 100.0%