MongoEngine / MongoEngine/mongoengine

Updating date modified field on .update?

Open
#1,847 6 comments 1 reaction 0 assignees View on GitHub

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:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.