我有一个像猫鼬的模型
const OffersSchema = new Schema({
storeIdList : [{
type: mongoose.Schema.Types.ObjectId,
ref: 'Stores',
required: true
}],
status: {
type: String,
required: true,
enum: ['INACTIVE', 'ACTIVE', 'SUSPENDED'],
default: 'INACTIVE'
}
// ...some other fields...
})
OffersSchema.index({"storeIdList":1,"status":1,"_id":-1})
然后我要查询:
let index = {"storeIdList":1,"status":1,"_id":-1}
let docs = await Offers.find({}).hint(index)
我得到一个错误“计划返回错误:错误提示”。 我在做什么错了?