Skip to content

Selecting a list value fails in mongomock, while succeeding in MongoDB #90

Closed

Description

@baruchoxman

For example, the following queries will not return anything:
{'list_value':[] }
{'list_value' : ['abc']}

when the doc is {'list_value':['abc']}

Proposed fix:
Change the following block in filtering.py:
elif isinstance(doc_val, (list, tuple)):
if isinstance(search, ObjectId):
is_match = (search in doc_val or str(search) in doc_val)
else:
is_match = search in doc_val

To:
elif isinstance(doc_val, (list, tuple)):
if isinstance(search, ObjectId):
is_match = (search in doc_val or str(search) in doc_val or search == doc_val)
else:
is_match = (search in doc_val or search == doc_val)

Activity

  1. added a commit that references this issue on Apr 14, 2014
  2. added a commit that references this issue on Apr 14, 2014
  3. baruchoxman commented on Jul 21, 2015

    @baruchoxman
    ContributorAuthor

    Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions