def handle(self, *args, **kwargs):
     q = {"$and": [{"_deleted_at": {"$exists": True}},
          {"_deleted_at": {"$ne": None}}]}
     cursor = xform_instances.find(q)
     c = 0
     for record in cursor:
         date_deleted = datetime_from_str(record[DELETEDAT])
         id = record[ID]
         if Instance.set_deleted_at(id, deleted_at=date_deleted):
             c += 1
         print "deleted on ", date_deleted
     print "-------------------------------"
     print "Updated %d records." % c
Esempio n. 2
0
 def handle(self, *args, **kwargs):
     q = {"$and": [{"_deleted_at": {"$exists": True}},
          {"_deleted_at": {"$ne": None}}]}
     xform_instances = settings.MONGO_DB.instances
     cursor = xform_instances.find(q)
     c = 0
     for record in cursor:
         date_deleted = datetime_from_str(record[DELETEDAT])
         id = record[ID]
         if Instance.set_deleted_at(id, deleted_at=date_deleted):
             c += 1
         print "deleted on ", date_deleted
     print "-------------------------------"
     print "Updated %d records." % c
Esempio n. 3
0
def _get_id_for_type(record, mongo_field):
    date_field = datetime_from_str(record[mongo_field])
    mongo_str = '$' + mongo_field

    return {"$substr": [mongo_str, 0, 10]} if isinstance(date_field, datetime)\
        else mongo_str
Esempio n. 4
0
def _get_id_for_type(record, mongo_field):
    date_field = datetime_from_str(record[mongo_field])
    mongo_str = '$' + mongo_field

    return {"$substr": [mongo_str, 0, 10]} if isinstance(date_field, datetime)\
        else mongo_str