code: def collection_keys(coll, sep='.'):
      
      def _keys(x, pre=''):
          for k in x:
              yield (pre + k)
              if isinstance(x[k], dict):
                  for nested in _keys(x[k], pre + k + sep):
                      yield nested
  
      return list(_keys(coll.find_one()))
docs: Get a list of all (including nested) keys in a collection.
      Examines the first document in the collection.
  
      :param sep: Separator for nested keys
      :return: List of str