【发布时间】:2019-09-04 01:00:41
【问题描述】:
我尝试使用 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 服务器来获取它。
【问题讨论】:
标签: javascript node.js mongodb object