我试图使用Node.js的Mongo驱动将long/BigInt
插入到我的MongoDB数据库中。
我已经尝试使用BigInt
,但它无法将数字(到期日)插入到文档中。
let expire = BigInt(parseInt((Date.now() / 1000) + 21600, 10));
let newDoc = {
type: "group.test",
expiry: expire
};
collection.insertOne(newDoc);
// it only inserts the type.
我希望它保存为BigInt,因为我们需要在Java服务器上获取它。