下面这段代码在PC模拟器上可以获得数据,而在手机预览却获得空的数据(list是空的):
errMsg: “collection.aggregate:ok” list: []
代码:
db.collection(‘post’)
.aggregate()
.skip(0)
.limit(LIMIT)
.sort({ updatedAt: -1 })
.project({
_id: 1,
_openid: 1,
comments: 1,
content: 1,
follows: 1,
reads: 1,
released: 1,
subject: 1,
updatedAt: $.dateToString({
date: ‘$updatedAt’,
format: ‘%m %d, %Y %H:%M:%S’,
//“month day, year hours:minutes:seconds”
timezone: ‘Asia/Shanghai’
}),
userInfo: 1
})
.end( )
.then(res => {
console.log(‘res’, res)
})
.catch(err => {
console.log(‘aggregated err’, err)
})