如何输出aggregate的结果?
请问一下如何输出aggregate后的结果?
const $ = db.command.aggregate
let temp=db.collection(‘recordmovement’).aggregate()
.match({
_openid: ‘5aO_tBixeUe2ULs6Z4fQ6yI’
})
.bucket({
groupBy: ‘$movement’,
boundaries: [‘1’, ‘50’],
default: ‘other’,
output: {
count: $.sum(‘$_id’),
ids: $.push(‘$_id’)
}
})
.end();
如果直接console.log(temp),则直接输出Promise {[[PromiseStatus]]: “pending”, [[PromiseValue]]: undefined
