【发布时间】:2019-02-04 07:28:13
【问题描述】:
我正在将一个文档插入一个名为 users 的集合中。插入后,我想返回文档 ID 以便继续使用它。所以我写了这段代码:
this.db.collection("users")
.insertOne({ xy })
.then(ref => {
console.log(ref.insertedId);
});
返回的insertedId 是这样的:
id:Uint8Array(12) [89, 131, 152, 99, 28, 157, 43, 0, 0, 90, 228, 11]
但是我真的不能用这个。我需要一个连续的字符串或数字。
任何帮助表示赞赏:)
【问题讨论】: