code: def list(self, offset=0, limit=0, fields=None, sort=None, **kwargs):
          
          try:
              cursor = self._cursor(offset=offset, limit=limit, fields=fields,
                                    sort=sort, **kwargs)
              return list(cursor), cursor.count()
          except pymongo.errors.OperationFailure as exc:
              # This is workaround for mongodb v2.4 and 'q' filter params
              try:
                  kwargs['$or'][0]['$text']['$search']
              except (KeyError, IndexError):
                  raise exc
              LOG.warn("Falling back to hard-coded mongo v2.4 search behavior")
              kwargs = self.search_alternative(limit, **kwargs)
              LOG.debug("Modified kwargs: %s", kwargs)
              cursor = self._cursor(offset=offset, limit=limit, fields=fields,
                                    sort=sort, **kwargs)
              return list(cursor), cursor.count()
docs: Return filtered list of documents in a collection.
  
          For text-based search, we support searching on a name/string field by
          regex and text index. So strings passed in to a r=text search are
          used to filter collections by text index and regex on a named field.
  
          :param offset: for pagination, which record to start attribute
          :param limit: for pagination, how many records to return
          :param fields: list of field names to return (otherwise returns all)
          :param sort: list of fields to sort by (prefix with '-' for descending)
          :param kwargs: key/values to find (only supports equality for now)
  
          :returns: a tuple of the list of documents and the total count