用mongoose 查询获得的Decimal128数据,进行转化?
发布于 6 年前 作者 Sxy97 3973 次浏览 来自 问答

[ { "openValue":{ "$numberDecimal":"119.931" }, "timestamp":"2017-01-20T10:30:00.000Z" }, { "openValue":{ "$numberDecimal":"119.965" }, "timestamp":"2017-01-20T10:31:00.000Z" } ],

怎样简单点转化为

[ { "openValue": 119.931, "timestamp":"2017-01-20T10:30:00.000Z" }, { "openValue": 119.965, "timestamp":"2017-01-20T10:31:00.000Z" }, { "openValue": 119.975, "timestamp":"2017-01-20T10:32:00.000Z" } ]

2 回复
var transform = map(
	evolve({
		openValue: prop('$numberDecimal')
    })	
)

@yviscool 兄台,能否详细赐教

回到顶部