Skip to main content
Help us improve Python packaging – donate today!

Stale data cleaner for MongoDB.

Project Description

Suppose you have two collections: users and pajamas

users collection contains the following document:
{'_id': 'foo@bar.com'}

pajamas collection contains the following document:
{'_id': ObjectID('5028...'), 'user': 'foo@bar.com', 'color': 'pink'}

Suppose you delete the user's document and forgot to delete his pajama. Now the pajama document is stale and takes up space on your database.

This tool find and removes stale documents.

To istall:

pip install mongo-cleaner

Sample usage:

import pymongo
from mongo_cleaner import Cleaner

structure = {
'pajamas': [('user', 'users')],
}

connection = pymongo.Connection()
db = connection['pajamaapp']

cleaner = Cleaner(structure, db)
cleaner.clean()

To see which documents are stale without removing them pass 'dry_run=True' to clean().

Release history Release notifications

This version
History Node

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
mongo-cleaner-0.1.tar.gz (1.9 kB) Copy SHA256 hash SHA256 Source None Aug 13, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page