mongo.Long $ inc大量失败

我正在使用nodejs(x64)下的mongodb 2.2.33 2.2.33库,并且在递增字段时遇到了问题:

  it('increment-test', function () { let db = repository.db; return setup .then(() => { return db.collection('product').save({ name: 'product1', amount: 0 }); }) .then(() => { return db.collection('product').update({}, { $inc: { "amount": mongo.Long(5000000000000000) } }); }) .then(() => { return db.collection('product').find({}).toArray(); }) .then((results) => { assert.equal(results[0].amount, 5000000000000000);//fails }) }); 

这个testing失败了; 而不是5000000000000000你实际上得到937459712

我怎样才能得到这个在NodeJS下工作? mongo.Long似乎是从mongo.Long使用的正确types,但不起作用。 如果你想知道上面的testing通过,当你使用另一个大于Int32 – 例如3147483647这是最大的数字是4294967296这是2^32 -1