mongodb - Is this a $mod query bug? Can't use divisor with more than 11 digits?
大家讲道理
大家讲道理 2017-05-02 09:24:54
0
1
558

I collected data from an administrative division and used the following command to query provincial-level data
db.collection.find({'_id':{$mod: [10000000000,0]}})
No data was returned
Normally the following data needs to be returned

{
    "_id" : NumberLong("110000000000"),
    "name" : "北京市"
},

/* 2 */
{
    "_id" : NumberLong("120000000000"),
    "name" : "天津市"
},

/* 3 */
{
    "_id" : NumberLong("130000000000"),
    "name" : "河北省"
},
...

I can use a 10-digit divisor to return data after removing a 0, but it is not what I need.
Is this a $mod bug?
There are no relevant instructions in the official documentation.

大家讲道理
大家讲道理

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

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