MongoEngine / MongoEngine/mongoengine

Combine Q and QCombination into one object

Open
#2,211 0 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

At this moment filters implementation consist of 3 classes:

  • QNode - abstract representation of a Q tree Node
  • Q - filter
  • QCombination, a combination of Qs

I find the current structure hard to work with, eg. I don't see a clear way to implement "contains" method, for checking if a filter is already in. Same with counting filter's length.

We could divide the logic between managing the tree graph and managing filters:

  • Node, a single node in the tree graph, holding methods for managing the tree graph only
  • Q, holding methods for managing filters within a tree graph, inheriting from Node

The structure will be more clear, easier to maintain, what's more we can easily expand it - eg. implementing "contains" and "len" methods, negation, ...

I can handle it, just let me know if that sounds reasonable for you.
User-wise, nothing changes, unless one was using QNode or QCombination directly (probably not a case)

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

No file or test is named; start by locating the implementations of QNode, Q, and QCombination and reviewing their public behavior. Define completion as a clearer Node/Q structure that preserves existing user-facing behavior, while accounting for possible direct users of QNode or QCombination.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, python
Domain
backend, database
Issue type
Refactor
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.