code: def list_collection_names(self, session=None, filter=None, **kwargs):
          
          if filter is None:
              kwargs["nameOnly"] = True
          else:
              # The enumerate collections spec states that "drivers MUST NOT set
              # nameOnly if a filter specifies any keys other than name."
              common.validate_is_mapping("filter", filter)
              kwargs["filter"] = filter
              if not filter or (len(filter) == 1 and "name" in filter):
                  kwargs["nameOnly"] = True
  
          return [result["name"]
                  for result in self.list_collections(session=session, **kwargs)]
docs: Get a list of all the collection names in this database.
  
          For example, to list all non-system collections::
  
              filter = {"name": {"$regex": r"^(?!system\.)"}}
              db.list_collection_names(filter=filter)
  
          :Parameters:
            - `session` (optional): a
              :class:`~pymongo.client_session.ClientSession`.
            - `filter` (optional):  A query document to filter the list of
              collections returned from the listCollections command.
            - `**kwargs` (optional): Optional parameters of the
              `listCollections command
              <https://docs.mongodb.com/manual/reference/command/listCollections/>`_
              can be passed as keyword arguments to this method. The supported
              options differ by server version.
  
          .. versionchanged:: 3.8
             Added the ``filter`` and ``**kwargs`` parameters.
  
          .. versionadded:: 3.6