MongoEngine / MongoEngine/mongoengine
Updating date modified field on .update?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 4.3k
- Forks
- 1.2k
- Avg merge
- 4h 41m
- Merged PRs (30d)
- 11
Description
Related issue where this scenario was brought up: #21, #451
My response bringing it up again: https://github.com/MongoEngine/mongoengine/issues/451#issuecomment-414149971
To my knowledge (please correct me if I'm mistaken!) the signal patterns only work with .save(). In the project I'm working on, we use .update and QuerySet's .update_one in various locations. My intuition is that these would would trigger a signal?
(To my knowledge, we don't have update hooks in Django ORM either, in favor of auto_now/auto_now_add, per discussion in #21): https://code.djangoproject.com/ticket/21461
Assuming this doesn't happen - is there a canonical way to have a updated/updated_at/modified/modified_at field update with .update without overriding the method on the document?
Other things:
- Examples in mongoengine documentation: http://docs.mongoengine.org/guide/signals.html#attaching-events (to my knowledge, this would only work if using
.save()? So a codebase could potentially be missing modified changes?) - StackOverflow question: https://stackoverflow.com/q/8098122
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the signal documentation linked in the issue and the QuerySet .update and .update_one entry points, then compare their behavior with .save(). The issue names no specific files or tests; done would require a decided, testable approach for updating modified fields during these operations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- mongodb, python
- Domain
- database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100