Get a collection of this database by name. Raises InvalidName if an invalid collection name is used. :param name: the name of the collection to get
(self, name: str)
| 227 | return f"{type(self).__name__}({self._client!r}, {self._name!r})" |
| 228 | |
| 229 | def __getattr__(self, name: str) -> Collection[_DocumentType]: |
| 230 | """Get a collection of this database by name. |
| 231 | |
| 232 | Raises InvalidName if an invalid collection name is used. |
| 233 | |
| 234 | :param name: the name of the collection to get |
| 235 | """ |
| 236 | if name.startswith("_"): |
| 237 | raise AttributeError( |
| 238 | f"{type(self).__name__} has no attribute {name!r}. To access the {name}" |
| 239 | f" collection, use database[{name!r}]." |
| 240 | ) |
| 241 | return self.__getitem__(name) |
| 242 | |
| 243 | def __getitem__(self, name: str) -> Collection[_DocumentType]: |
| 244 | """Get a collection of this database by name. |
nothing calls this directly
no test coverage detected