I have a Mongoose model like
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})
And later I'm querying:
let index = {"storeIdList":1,"status":1,"_id":-1}
let docs = await Offers.find({}).hint(index)
And I'm getting an error "planner returned error: bad hint". What am I doing wrong?