目前正在使用它,但似乎没有加载。这只是需要一段时间还是我做错了什么?我的数据库在模数上是 3.0.3 而我的外壳是 3.2.1
db.itemtemplates.find().snapshot().forEach(
function (e) {
// update document, using its own properties
e._id = e._id.str
db.itemtemplates.save(e);
}
)
目前正在使用它,但似乎没有加载。这只是需要一段时间还是我做错了什么?我的数据库在模数上是 3.0.3 而我的外壳是 3.2.1
db.itemtemplates.find().snapshot().forEach(
function (e) {
// update document, using its own properties
e._id = e._id.str
db.itemtemplates.save(e);
}
)
ObjectId
将 an 转换为字符串的正确方法是toString()
,请参阅文档。
db.itemtemplates.find().snapshot().forEach(
function (e) {
// update document, using its own properties
e._id = e._id.toString()
db.itemtemplates.save(e);
}
)