aggregate( )在小程序手机预览和IDE模拟器表现不一致?
发布于 6 年前 作者 na51 15115 次浏览 来自 官方Issues

下面这段代码在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)

})

3 回复

更奇怪的是,前段时间手机端也是可以获得数据,这周才出现的。

感谢反馈,请使用 >2.8.1 版本的公共库测试呢?现在已发布 2.8.2,因此 2.8.1 的都会被自动升级修复这个 bug 了

碰到同样的问题:小程序手机预览和IDE模拟器表现不一致。o(╥﹏╥)o

回到顶部