MongoEngine / MongoEngine/mongoengine

model having sequence field misbehaves when i select specific fields using only

Open
#1,413 8 comments 0 reactions 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

Friends,

I am facing following issue

  1. I have a model which contains SequenceField (Ex: MyModel which contains a sequence field say seqid)
  2. When i do a normal query on that model (Ex: MyModel.objects(name="arul")) it works properly
  3. if i want to select specific fields, it gives me a new object whose sequence field incremented (Ex: MyModel.objects(name="arul").only("id", "enabled" returns a new object with seqid field increment)

Please let me know if i am missing something

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 reproducing the reported behavior with MyModel.objects(name="arul") and the .only("id", "enabled") query, comparing the sequence field in each returned object. Trace the model query and SequenceField handling involved in that path; done means selecting specific fields no longer increments or unexpectedly assigns the sequence field.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, python
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.