code: def aggregate(self, pipeline, **kwargs):
          
          result = self.collection.aggregate(pipeline, **kwargs)
          if pymongo.version_tuple < (3, 0, 0):
              result = result['result']
  
          return result
docs: Perform an aggregation and make sure that result will be everytime
          CommandCursor. Will take care for pymongo version differencies
          :param pipeline: {list} of aggregation pipeline stages
          :return: {pymongo.command_cursor.CommandCursor}