code: def reindex(self):
          
          cmd = SON([("reIndex", self.__name)])
          with self._socket_for_writes() as sock_info:
              return self._command(
                  sock_info, cmd, read_preference=ReadPreference.PRIMARY,
                  parse_write_concern_error=True)
docs: Rebuilds all indexes on this collection.
  
          .. warning:: reindex blocks all other operations (indexes
             are built in the foreground) and will be slow for large
             collections.
  
          .. versionchanged:: 3.4
             Apply this collection's write concern automatically to this operation
             when connected to MongoDB >= 3.4.
  
          .. versionchanged:: 3.5
             We no longer apply this collection's write concern to this operation.
             MongoDB 3.4 silently ignored the write concern. MongoDB 3.6+ returns
             an error if we include the write concern.