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