mongodb - 这是 $mod query 的bug吗?不能使用超过11位的除数?
大家讲道理
大家讲道理 2017-05-02 09:24:54
0
1
497

我采集了一个行政区划的数据,使用如下命令查询省一级的数据
db.collection.find({'_id':{$mod: [10000000000,0]}})
没有任何返回数据
正常需要返回如下数据

{ "_id" : NumberLong("110000000000"), "name" : "北京市" }, /* 2 */ { "_id" : NumberLong("120000000000"), "name" : "天津市" }, /* 3 */ { "_id" : NumberLong("130000000000"), "name" : "河北省" }, ...

我去掉一个0后能使用10位的除数能返回数据,但不是我的需求。
这是否是$mod的bug?
官方文档中没有相关的说明。

大家讲道理
大家讲道理

光阴似箭催人老,日月如移越少年。

reply all (1)
左手右手慢动作

I tested it, and now it is:

1. Under mongo shell, the situation is the same as you described;

2. Under mongodb driver 2.2.24, the situation is the same as you described;

error: null result: undefined

3.mongoose driver 4.7.9,

error : Can't use $mod with ObjectId.

It is recommended to visit: https://jira.mongodb.org/secu... ; and submit an issue for tracking.

For reference.

Love MongoDB! Have Fun!

------------------------Gorgeous separator--------------------- ----------

MongoDB Chinese community has many offline activities, please click below:

2017 Huashan Sword Discussion|MongoDB Chinese Community

Hangzhou Station is coming in March! ! ! Interested friends please sign up quickly! ! !

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!