尝试为Web应用程序创建架构,但是无法正确映射多个用户的orderHistory
Users = {
email: 'sample1@mail.com',
username: 'sample1',
orderHistory:
[ { order_date_time: '2019-02-12T05:00:00.000Z',
xmr_hr: 9000,
xmr_pwr: 1080,
}],
email: 'sample2@mail.com',
username: 'sample2',
orderHistory:
[ { order_date_time: '2019-02-13T08:47:26.398Z',
eth_hr: 350,
eth_pwr: 1000, } ]
}
var orders= Users.orderHistory.map(element => element)
console.log(orders)
请记住,此Users变量假设来自Mongoose User.find({})函数(基本上是User.findAll)
尝试在本地范围内模拟它,这样我就可以看到发生了什么,因为我的API似乎并没有获取我想要的所有正确值