Get a sub-collection of this collection by name. Raises InvalidName if an invalid collection name is used. :param name: the name of the collection to get
(self, name: str)
| 267 | raise ValueError("Collection does not support the `create` or `kwargs` arguments.") |
| 268 | |
| 269 | def __getattr__(self, name: str) -> Collection[_DocumentType]: |
| 270 | """Get a sub-collection of this collection by name. |
| 271 | |
| 272 | Raises InvalidName if an invalid collection name is used. |
| 273 | |
| 274 | :param name: the name of the collection to get |
| 275 | """ |
| 276 | if name.startswith("_"): |
| 277 | full_name = f"{self._name}.{name}" |
| 278 | raise AttributeError( |
| 279 | f"{type(self).__name__} has no attribute {name!r}. To access the {full_name}" |
| 280 | f" collection, use database['{full_name}']." |
| 281 | ) |
| 282 | return self.__getitem__(name) |
| 283 | |
| 284 | def __getitem__(self, name: str) -> Collection[_DocumentType]: |
| 285 | return Collection( |
nothing calls this directly
no test coverage detected