예제 #1
0
파일: models.py 프로젝트: bianchimro/sketch
def dropObsoleteMongoResults():

    out = []
    qset = CollectionReference.objects.all()
    referenced = [obj.collection_name for obj in qset]
    
    from sketch.mongowrapper import mongo, default_mongo_db
    collections = mongo.getDb(default_mongo_db).collection_names()
    for coll in collections:
        if coll.startswith("results"):
            if coll not in referenced:
                out.append(coll)
                mongo.dropCollection(default_mongo_db, coll)
                
    return out