Why $in is much faster than $all?

前端 未结 2 1047
孤城傲影
孤城傲影 2021-01-28 02:30
db.tablebusiness.find({ \"LongitudeLatitude\" : { \"$nearSphere\" : [106.772835, -6.186753], \"$maxDistance\" : 0.053980478460939611 }, \"Prominent\" : { \"$gte\" : 15 }         


        
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-28 02:43

    I asked a similar question in Why using $all in mongodb is much slower?

    This time I use only one word. Hence, there should be no difference between $in and $all. They both are equivalent.

    Still $all is much slower.

    Turns out, per answer on that, there is a bug in mongodb itself.

    https://jira.mongodb.org/browse/SERVER-1748

    I guess I simply won't use $all at all until the problem is fixed.

    To all other answers, have you tried this your self?

提交回复
热议问题