Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version: 1.16.3 #452

Merged
merged 2 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/close_inactive_issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
stale-pr-message: 'This PR is stale because it has been open 45 days with no activity.'
close-issue-message: 'This issue was closed because it has been stalled for 14 days with no activity.'
close-pr-message: 'This PR was closed because it has been stalled for 14 days with no activity.'
exempt-issue-labels: 'bug'
exempt-issue-labels: 'bug,feature-request'
days-before-issue-stale: 30
days-before-pr-stale: 45
days-before-issue-close: 14
Expand Down
2 changes: 1 addition & 1 deletion beanie/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from beanie.odm.views import View
from beanie.odm.union_doc import UnionDoc

__version__ = "1.16.2"
__version__ = "1.16.3"
__all__ = [
# ODM
"Document",
Expand Down
3 changes: 2 additions & 1 deletion beanie/odm/queries/find.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
UpdateMany,
UpdateOne,
)
from beanie.odm.utils.dump import get_dict
from beanie.odm.utils.encoder import Encoder
from beanie.odm.utils.find import construct_lookup_queries
from beanie.odm.utils.parsing import parse_obj
Expand Down Expand Up @@ -818,7 +819,7 @@ async def replace_one(
result: UpdateResult = (
await self.document_model.get_motor_collection().replace_one(
self.get_filter_query(),
Encoder(by_alias=True, exclude={"_id"}).encode(document),
get_dict(document, to_db=True, exclude={"_id"}),
session=self.session,
)
)
Expand Down
11 changes: 8 additions & 3 deletions beanie/odm/utils/dump.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Optional, Set

from beanie.odm.utils.encoder import Encoder

if TYPE_CHECKING:
from beanie.odm.documents import Document


def get_dict(document: "Document", to_db: bool = False):
exclude = set()
def get_dict(
document: "Document",
to_db: bool = False,
exclude: Optional[Set[str]] = None,
):
if exclude is None:
exclude = set()
if document.id is None:
exclude.add("_id")
if not document.get_settings().use_revision:
Expand Down
14 changes: 13 additions & 1 deletion docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

Beanie project

## [1.16.3] - 2022-12-19

### Fix

- [[BUG] revision_id field saved in MongoDB using save()/replace() on an existing document even if use_revision is False](https://github.com/roman-right/beanie/issues/420)

### Implementation

- PR <https://github.com/roman-right/beanie/pull/452>

## [1.16.2] - 2022-12-19

### Fix
Expand Down Expand Up @@ -1155,4 +1165,6 @@ how specific type should be presented in the database

[1.16.1]: https://pypi.org/project/beanie/1.16.1

[1.16.2]: https://pypi.org/project/beanie/1.16.2
[1.16.2]: https://pypi.org/project/beanie/1.16.2

[1.16.3]: https://pypi.org/project/beanie/1.16.3
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "beanie"
version = "1.16.2"
version = "1.16.3"
description = "Asynchronous Python ODM for MongoDB"
authors = ["Roman <roman-right@protonmail.com>"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_beanie.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@


def test_version():
assert __version__ == "1.16.2"
assert __version__ == "1.16.3"