Skip to content

not__match__nin is not working #1034

Open
@namtuoc0202

Description

@namtuoc0202

I have DB like this

{ "_id" : ObjectId("558233a3f89235c3ef7e2985"), "list" : [ "1", "2", "3", "4", "5" ] }
{ "_id" : ObjectId("558233abf89235c3ef7e2986"), "list" : [ "6", "2", "3", "4", "5" ] }

and raw query is:

> db.chara.find({list: {$not: {$elemMatch: {$nin: ["2", "3", "4", "5", "6", "7"]}}}})
{ "_id" : ObjectId("558233abf89235c3ef7e2986"), "list" : [ "6", "2", "3", "4", "5" ] }

But when I use this query, it may be ignore and all record be showed

chara.objects.filter(list__not__match__nin=["2", "3", "4", "5", "6", "7"])

However, this work perfectly:

chara.objects.filter(__raw__={"compare_targets": {"$not": {"$elemMatch": {"$nin": ["2", "3", "4", "5", "6", "7"]}}}})

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions