diff --git a/beanie/__init__.py b/beanie/__init__.py index a8adb196..66afd29f 100644 --- a/beanie/__init__.py +++ b/beanie/__init__.py @@ -5,7 +5,7 @@ from beanie.odm.documents import Document from beanie.odm.cursor import Cursor -__version__ = "0.4.0" +__version__ = "0.4.1" __all__ = [ # ODM "Document", diff --git a/docs/changelog.md b/docs/changelog.md index 24f31540..ef434ef4 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,6 +1,10 @@ # Changelog Beanie project changes +## [0.4.1] - 2021-04-19 +### Added +- Projections support to reduce database load. [Issue](https://github.com/roman-right/beanie/issues/16). **Thanks [Nicholas Smith](https://github.com/nzsmith1)** + ## [0.4.0] - 2021-04-18 ### Added - [ODM Documentation](https://roman-right.github.io/beanie/documentation/odm/) @@ -53,4 +57,5 @@ Beanie project changes [0.3.3]: https://pypi.org/project/beanie/0.3.3 [0.3.4]: https://pypi.org/project/beanie/0.3.4 [0.4.0b1]: https://pypi.org/project/beanie/0.4.0b1 -[0.4.0]: https://pypi.org/project/beanie/0.4.0 \ No newline at end of file +[0.4.0]: https://pypi.org/project/beanie/0.4.0 +[0.4.1]: https://pypi.org/project/beanie/0.4.1 \ No newline at end of file diff --git a/docs/documentation/odm.md b/docs/documentation/odm.md index 8c8ef8a6..7cfdb6a9 100644 --- a/docs/documentation/odm.md +++ b/docs/documentation/odm.md @@ -63,7 +63,8 @@ Creates internal CollectionMeta class for the Document on the init step, - `database`: AsyncIOMotorDatabase - Motor database instance - `document_class`: Type - a class, inherited from Document class - `allow_index_dropping`: bool - if index dropping is allowed -- `collection_class`: Optional[Type] - Collection, which was set up by user +- `collection_class`: Optional[Type] - Collection, which was set up +by user **Returns**: @@ -101,9 +102,10 @@ Beanie initialization **Arguments**: - `database`: AsyncIOMotorDatabase - motor database instance -- `document_models`: List[Union[Type[Document], str]] - model -classes or strings with dot separated paths -- `allow_index_dropping`: bool - if index dropping is allowed. Default True +- `document_models`: List[Union[Type[Document], str]] - model classes +or strings with dot separated paths +- `allow_index_dropping`: bool - if index dropping is allowed. +Default True **Returns**: @@ -170,7 +172,8 @@ Insert many documents to the collection **Arguments**: - `documents`: List["Document"] - documents to insert -- `keep_ids`: bool - should it insert documents with ids or ignore it? Default False - ignore +- `keep_ids`: bool - should it insert documents with ids +or ignore it? Default False - ignore - `session`: ClientSession - pymongo session **Returns**: @@ -223,8 +226,9 @@ Find many documents by criteria - `filter_query`: dict - The selection criteria. - `skip`: Optional[int] - The number of documents to omit. - `limit`: Optional[int] - The maximum number of results to return. -- `sort`: Union[None, str, List[Tuple[str, SortDirection]]] - A key or a list of (key, direction) pairs - specifying the sort order for this query. +- `sort`: Union[None, str, List[Tuple[str, SortDirection]]] - A key +or a list of (key, direction) pairs specifying the sort order +for this query. - `session`: ClientSession - pymongo session **Returns**: @@ -245,8 +249,9 @@ Get all the documents - `skip`: Optional[int] - The number of documents to omit. - `limit`: Optional[int] - The maximum number of results to return. -- `sort`: Union[None, str, List[Tuple[str, SortDirection]]] - A key or a list of (key, direction) pairs - specifying the sort order for this query. +- `sort`: Union[None, str, List[Tuple[str, SortDirection]]] - A key +or a list of (key, direction) pairs specifying the sort order +for this query. - `session`: ClientSession - pymongo session **Returns**: @@ -280,7 +285,8 @@ Fully update one document in the database **Arguments**: - `filter_query`: dict - the selection criteria. -- `document`: Document - the document which will replace the found one. +- `document`: Document - the document which will replace the found +one. - `session`: ClientSession - pymongo session. **Returns**: @@ -484,7 +490,8 @@ Aggregate **Arguments**: - `aggregation_query`: List[dict] - query with aggregation commands -- `item_model`: Type[BaseModel] - model of item to return in the list of aggregations +- `item_model`: Type[BaseModel] - model of item to return in the +list of aggregations - `session`: ClientSession - pymongo session. **Returns**: @@ -570,7 +577,8 @@ InspectionResult class Cursor() ``` -Cursor class. Wrapper over AsyncIOMotorCursor, which parse result with model +Cursor class. Wrapper over AsyncIOMotorCursor, +which parse result with model #### to\_list diff --git a/pyproject.toml b/pyproject.toml index f7793b67..b9b3edbc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "beanie" -version = "0.4.0" +version = "0.4.1" description = "Asynchronous Python ODM for MongoDB" authors = ["Roman "] license = "Apache-2.0" diff --git a/scripts/build_odm_doc.sh b/scripts/build_odm_doc.sh new file mode 100644 index 00000000..b58138d7 --- /dev/null +++ b/scripts/build_odm_doc.sh @@ -0,0 +1 @@ +pydoc-markdown -I beanie/odm --render-toc > docs/documentation/odm.md \ No newline at end of file diff --git a/tests/test_beanie.py b/tests/test_beanie.py index 9d42de99..58eef7bd 100644 --- a/tests/test_beanie.py +++ b/tests/test_beanie.py @@ -2,4 +2,4 @@ def test_version(): - assert __version__ == "0.4.0" + assert __version__ == "0.4.1"