Mim: $ne with array

Open
#10 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reproducing the query against the four documents shown in the issue, focusing on Mim's handling of hist.int with $ne when hist is empty or missing. Compare the result with MongoDB's behavior; done means the query also returns foo2 while preserving the expected results for the other documents.

Written by the indexing model from the issue text.

Description

Mim does not match mongodb's behavior concerning matching sub-lists with $ne when the field is an empty list.

    self.bind.db.coll.insert(
        {'_id':'foo', 'hist': [{'int': 2}]}
    )
    self.bind.db.coll.insert(
        {'_id':'foo2', 'hist': []}
    )
    self.bind.db.coll.insert(
        {'_id':'foo3'}
    )
    self.bind.db.coll.insert(
        {'_id':'foo4', 'hist': [{'foo': 'bar'}]}
    )

    objs = self.coll.find({'hist.int': {'$ne': 5235}}).all()
    # this returns foo, foo3, foo4 but should also return foo2

Note https://docs.mongodb.com/manual/reference/operator/query/ne/index.html doesn't specify behavior for empty lists, but we should match how mongodb actually works.

Dominant language
Python
Stars
30
Forks
17
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

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.

More from TurboGears/Ming

All issues in TurboGears/Ming

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.