【发布时间】:2020-01-16 17:12:47
【问题描述】:
在尝试以下代码时:
db.getCollection('col').find({}).forEach(function(doc){
var id = new UUID().toString(); // this doesn't work, neither does 'var id = new UUID();'
db.getCollection('pubCol')
.update({
"uuid" : id,
"deleted" : false
}
, {upsert: true});
});
我最终分别得到以下结果
"uuid" : "UUID(\"4554a991-2b7f-4464-b871-5f4e91332630\")"
"uuid" : UUID("4554a991-2b7f-4464-b871-5f4e91332630")
但我正在寻找
"uuid" : "4554a991-2b7f-4464-b871-5f4e91332630"
【问题讨论】:
标签: string mongodb shell uuid robo3t