Ming icon indicating copy to clipboard operation
Ming copied to clipboard

Mim: $ne with array

Open brondsem opened this issue 6 years ago • 0 comments

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.

brondsem avatar Apr 02 '19 16:04 brondsem