1 回答
- 最新
- 投票最多
- 评论最多
0
Hello. You could use the Javascript parseFloat() method and programmatically update those strings to double in the existing collection. Or use an $out stage in the aggregation and update the results afterwards. Something like this will loop through all documents in the collection and update the string:
db.collection.find({}).forEach( function(doc) {
doc.subDoc.stringVar = parseFloat( doc.subDoc.stringVar );
db.collection.update( { _id: doc._id }, {$set: { "subDoc.stringVar": doc.subDoc.stringVar } } )
});
已回答 2 年前
相关内容
- AWS 官方已更新 4 年前
- AWS 官方已更新 9 个月前
- AWS 官方已更新 9 个月前