我的貓鼬查詢:排序和貓鼬不同
Spread.find(findCase).where('loc').near({
center: {
type: 'Point',
coordinates: [self.lon, self.lat]
},
maxDistance: distance
}).sort({ts : -1}).distinct("postId").exec();
所以我得到的錯誤:
Error: sort cannot be used with distinct
但是,如果我通過查詢與控制檯
db.spreads.distinct({}).sort({ts: -1});
也就是說好。
那麼,爲什麼貓鼬不讓我選擇不同的和排序在一個查詢中,我該怎麼做呢?
你能告訴我們什麼貓鼬實際上試圖執行?只需啓用調試標誌'mongoose.set('debug',true)'。 – Pio 2015-01-15 18:11:08
調試模式已設置。在記錄完整查詢之前,錯誤將引發mongoose/node_modules/mquery/lib/mquery.js:2405 – 2015-01-15 19:46:12