code: def _expand(self, name):
          
          cfg = self._d[name]
          if cfg.collection is None:
              base_coll = ''
          else:
              base_coll = cfg.collection + self.SEP
          qe = self._get_qe(name, cfg)
          coll, db = qe.collection, qe.db
          cur_coll = coll.name
          for coll_name in db.collection_names():
              if coll_name == cur_coll or not coll_name.startswith(base_coll):
                  continue
              ex_cfg = cfg.copy()
              ex_cfg.collection = coll_name
              group_name = name + self.SEP + coll_name[len(base_coll):]
              self.add(group_name, ex_cfg, expand=False)
docs: Perform real work of `expand()` function.