code: def update(self, collection_name, instance):
          
          assert isinstance(instance, SiteStatistics)
          if instance.db_id:
              query = {'_id': ObjectId(instance.db_id)}
          else:
              query = {DOMAIN_NAME: instance.domain_name,
                       TIMEPERIOD: instance.timeperiod}
          self.ds.update(collection_name, query, instance)
          return instance.db_id
docs: method finds Site Statistics record and update it DB representation